Java does not force 2D arrays to be flat contiguous rectangles: an int[][] is literally an array whose slots store references to 1D int[] row arrays. That design makes jagged rows easy—and explains why shallow copying a 2D array still shares its rows.
More lessons in Complete Core Java