I want to make a matrix which has M rows and N columns using the scanner.
If i try to do it this way:
Scanner input = new Scanner(System.in);
int m=input.nextInt();
int n=input.nextInt();
String[][] matrix = new String[m][n];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
matrix [i][j] = input.nextLine();
}
}
It won't work.
How can i make this work?
Simple example of a matrix i want:
3 4
* * * *
* * * *
* * * *