-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtester.java
37 lines (34 loc) · 1.28 KB
/
tester.java
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
31
32
33
34
35
36
37
public class tester {
public static void main(String[] args) {
int[][] jaggedArray = new int[5][];
// Filling the jagged array with increasing values
int counter = 1;
for (int i = 0; i < jaggedArray.length; i++) {
jaggedArray[i] = new int[i + 1];
for (int j = 0; j < jaggedArray[i].length; j++) {
jaggedArray[i][j] = counter++;
}
}
// Printing the jagged array
for (int i = 0; i < jaggedArray.length; i++) {
for (int j = 0; j < jaggedArray[i].length; j++) {
System.out.print(jaggedArray[i][j] + " ");
}
System.out.println();
}
}
}
// public class tester {
// // test the triangle circle and rectangle classes
// public static void main(String[] args) {
// Triangle t = new Triangle(3, 4, 5);
// Circle c = new Circle(5);
// Rectangle r = new Rectangle(3, 4);
// System.out.println("Triangle area: " + t.getArea());
// System.out.println("Triangle perimeter: " + t.getPerimeter());
// System.out.println("Circle area: " + c.getArea());
// System.out.println("Circle perimeter: " + c.getPerimeter());
// System.out.println("Rectangle area: " + r.getArea());
// System.out.println("Rectangle perimeter: " + r.getPerimeter());
// }
// }