I am working on arrays and wanted to create separate classes for separate methods...i made a class of taking input of all the elements of arrays...and on the second class i want to get that array which was input by the user..Please help me... here's my code :
import java.util.Scanner;
public class makeArrayMethod {
public static void main() {
Scanner in = new Scanner(System.in);
int an, i, n;
System.out.println("Size of the Array : ");
an = in.nextInt();
int[] arr = new int[an];
System.out.println("Enter the number in the array : ");
for (i = 0; i < arr.length; i++) {
n = in.nextInt();
arr[i] = n;
}
}
}