- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrowlength.java
More file actions
Latest commit
17 lines (15 loc) · 509 Bytes
/
Copy pathrowlength.java
File metadata and controls
17 lines (15 loc) · 509 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//this program calculates length of earch row in a 2d array
publicclassrowlength{
publicstaticvoidmain(String[] args) {
// create a 2d array
int[][] a = {
{1, 2, 3},
{4, 5, 6, 9},
{7},
};
// calculate the length of each row
System.out.println("Length of row 1: " + a[0].length);
System.out.println("Length of row 2: " + a[1].length);
System.out.println("Length of row 3: " + a[2].length);
}
}