Two dimensional Array
Two dimensional Array
import java.util.Scanner;
int m = scanner.nextInt();
int n = scanner.nextInt();
matrix[i][j] = scanner.nextInt();
System.out.println();
}
}
Output;
12
13
14
15
12 13
14 15
2. Write a program to create store and display the value of jagged array with each row has different
number of columns.
import java.util.Scanner;
public class TwoDimension1 {
jaggedArray[i][j] = scanner.nextInt();
System.out.println();
}
Output;
Element at [1][0]: 6
Element at [1][1]: 5
Element at [2][0]: 3
Element at [2][1]: 5
Element at [2][2]: 8
Element at [2][3]: 7
65
3587