I dont understand why this isnt working, i keep getting an error on the printarray call that says "The method printArray(int[]) is undefined for the type Array_1m"
here is my main class
import java.util.Scanner;
public class Array_1m{
public static void main(String[] args){
int[] intarray = new int[] {1,2,3,4,5} ;
System.out.println("Here are our starting arrays");
printArray(intarray);
System.out.println("What would you like to do?");
System.out.println("");
}
}
here is my array class, i have to make a bunch of different methods for this class to be used in the main class and im just trying to print two arrays initially in order to manipulate them later. ill probably be back on here later for more help because I am having so much trouble with this program.
import java.util.ArrayList;
import java.util.Scanner;
public class Array_1 {
int[] internalarray;
public Array_1(int x) {
if(x>0) {
this.internalarray = new int [x];
}
else {
System.out.println("Error: Array size must be non-negative");
}
}
public static void printArray(int[] intarray) {
for (int i = 0; i < intarray.length; i++) {
if (i > 0) {
System.out.print(", ");
}
System.out.print(intarray[i]);
}
}
}

Array_1.printArray(intarray);