class Main { public static void main(String[] args) { int [][] arr1= {{1, 2, 3}, {4, 5}}; for(int i = 0; i < arr1.length; i++){ for(int j = 0; j < arr1[i].length; j++) { System.out.println(arr1[i][j]); } } } } /* 1 2 3 4 5 */
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter