-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_2b_9_jagged_array.java
More file actions
30 lines (27 loc) · 1006 Bytes
/
Copy path_2b_9_jagged_array.java
File metadata and controls
30 lines (27 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.*;
import java.util.Arrays;
class _2b_9_jagged_array {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int[] Raja = {78,85,0,0,0};
int[] Dev = {81,89,90,76,0};
int[] Arush = {54,67,78,0,0};
int[] John = {56,87,54,45,78};
//int[][] marks = {{'Raja',78,85},{'Dev',81,89,90,76},{"Arush",54,67,78},{"John",56,87,54,45,78}};
int[][] marks = {Raja, Dev, Arush, John};
String[] names = {"Raja", "Dev", "Arush", "John"};
System.out.println("\nEnter name of student whose marks are to be shown: ");
String name = s.next();
for (int i=0; i<4; i++) {
if (name.equalsIgnoreCase(names[i])) {
System.out.println("\nMarks for " + name + " are: ");
for (int k=0; k<5; k++) {
System.out.println(marks[i][k]);
}
}
else {
continue;
}
}
}
}