This is my code, I'm thinking to update the instance variable m, so that I can update my array1[m].. does anyone have suggestion? please help thank you
private int m;
private int n;
private int array1[] = new int[m];
private int array2[][] = new int[m][n];
public int Init()
{
Scanner input = new Scanner(System.in);
Random r = new Random();
do
{
System.out.print("Enter m for array1 [10, 100]: ");
m = input.nextInt();
if (m < 10 || m > 100)
System.out.println("Error: please try again");
}
while (m < 10 || m > 100);
System.out.println();
System.out.println("Initial Array Elements");
for (int i = 0; i < array1.length; i++)
{
array1[i] = r.nextInt(101) + 10;
System.out.printf("%d ", array1[i]);
}
System.out.println();
}