Java - Arrays

Arrays

int[] a = new int[]{1,2,3};
int n = a.length;
for (int v : a) System.out.println(v);

int[][] grid = {{1,2},{3,4}};
System.out.println(grid[1][0]); // 3

Arrays are fixed-size; prefer collections for dynamic resizing.

Try it

  1. Reverse an array in place.
  2. Create a jagged 2D array and print it row by row.