/* */ public class ArraySnippets { public static void main(String[] args) { test1( ); test2( ); } public static void test1( ) { char[][] a = new char[5][8]; for ( int r = 0; r < a.length; r++ ) for ( int c = 0; c < a[r].length; c++ ) a[r][c] = ' '; } public static void test2( ) { char[ ][ ] a = new char[5][ ]; a[0] = new char[8]; a[1] = new char[3]; a[2] = new char[5]; a[3] = new char[0]; a[4] = null; for ( int r = 0; r < a.length; r++ ) if (a[r] != null) System.out.println( a[r].length ); else System.out.println( "null" ); int[ ][ ] quizScores = { { 90, 82, 75, 66 }, { 85 }, { 45, 77, 99 } }; for ( int r = 0; r < quizScores.length; r++ ) { System.out.print( "Scores for student " + r + ":"); for ( int c = 0; c < quizScores[r].length; c++ ) System.out.print( " " + quizScores[r][c] ); System.out.println( ); } } }