Created
June 2, 2009 02:58
-
-
Save twopoint718/121955 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PrintArray | |
{ | |
public static void main(String[] args) | |
{ | |
// the basics of printing a 2d array | |
int[][] a = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; | |
for (int i = 0; i < a.length; i++) { | |
int[] currRow = a[i]; | |
for (int j = 0; j < currRow.length; j++) { | |
System.out.format("Item at (%d, %d) is %d\n", i, j, a[i][j]); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment