Try creating the triangular array from the previous section into a simple class or in jshell. Heres

Question:

Try creating the triangular array from the previous section into a simple class or in jshell. Here’s one way: 

int[][] triangle = new int[5][]; for (int i = 0; i < triangle.length; i++) { triangle[i] = new int [i + 1];

Now expand that code to print the contents of triangle to the screen. To help, recall that you can print the value of an array element with the System.out.println() method: 

System.out.println(triangle[3][1]);

Your output will probably be a long, vertical line of numbers like this: 

0
1
2
2
3
4
3
4

5
6
4
5
6
7
8

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: