I am learning java. I wrote the following code but I am getting this error \"cant make a static reference to a non static input field\" in Arrayfunction(), when I try to take in
either make your Scanner static and use it inside the static methods or create an instance of the class an access scanner from your static method.
static Scanner input= new Scanner(System.in);
public static void Arrayfunction(int array[][])
{
System.out.println("Enter a number");
array[i][j]=input.nextInt();// error
}
OR
Scanner input= new Scanner(System.in);
public static void Arrayfunction(int array[][])
{
System.out.println("Enter a number");
array[i][j]=new MultidimArrays().input.nextInt();// error
}