-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTwoD.java
More file actions
26 lines (21 loc) · 734 Bytes
/
TwoD.java
File metadata and controls
26 lines (21 loc) · 734 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
package Array;
public class TwoD {
public static void main(String[] args){
// String[] fruits = {"apple", "mango", "banana"};
// String[] veg = {"potato", "onion", "carrot"};
// String[] pack = {"biskit", "namkeen", "chocolate"};
// String [][] groceries = {fruits, veg, pack};
String[][] groceries = {
{"apple", "mango", "banana"},
{"potato", "onion", "carrot"},
{"biskit", "namkeen", "chocolate"}
};
groceries[0][1] = "pineapple";
for(String[] foods : groceries){
for(String food : foods){
System.out.print(food + "\t");
}
System.out.println();
}
}
}