I want to display an array of input that I input. and in print automatically. I want to display the array of input values that I input. and will be printed automatically.
my code like this :
public class ReadArray {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Input total row : ");
int row = sc.nextInt();
System.out.print("Input total column : ");
int column = sc.nextInt();
int [][] matrix = new int[row][column];
for (int i = 0; i < row; i++)
{
for(int j = 0; j < column; j++) {
System.out.println("Row ["+i+"]: Column "+j+" :");
matrix[i][j] = sc.nextInt();
}
}
}
}
I want results like this :
Input total row : 2 Input total column : 2
Row [0]: Column 0 : 1
Row [0]: Column 1 : 2
Row [1]: Column 0 : 10
Row [1]: Column 1 : 11
Data Array 1 : 1,2 Data Array 2 : 10,11
anyone can help me please.