Please check the code
Hello everyone! I've written array sum code in eclipse and it's working perfectly. There I have one package and the .java files. I've tried to write this code in sololearn website and I'm getting one error. What's the problem? ..\Playground\:14: error: non-static method sum(int[]) cannot be referenced from a static context System.out.println(test.sum(arr)); import java.util.Scanner; public interface Arrsum { public int sum (int [] arr); } public class test implements Arrsum { @Override public int sum (int [] arr) { int z = 0; for (int i = 0; i < arr.length; i++) { z += arr[i]; } return z; } } public class Program { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int [] arr = new int [5]; for (int i = 0; i < arr.length; i++) { arr[i] = scn.nextInt(); } test ts = new test(); System.out.println(test.sum(arr)); } }