I can not initialize a two dimensional array using for loop
import java.util.Scanner;
public class Quater{
public static void main(String[] args){
//declare an array
double product[][]=new double[3][2];
//declare a Scanner object
Scanner userInput=new Scanner(System.in);
//ask the user for input
System.out.println("Please enter your data");
for(int i=0;i<=1;i++)
{
for(int j=0;j<=2;j++){
System.out.println(" enter your data");
product[i][j]=userInput.nextDouble();
}
}
}
}
The problem is when I try to enter the third number, This shut down and not working, however, if I make it new double[100][100], this can work and allow me to enter 6 number.