String[] strArray = new String[8] ; // combined statement . . . . strArray[ strArray.length-1 ] = "the end" ;
Here is a fragment that writes out the first two Strings to the monitor:
System.out.println( "Slot 0: " + strArray[0] ); System.out.println( "Slot 1: " + strArray[1] );
Nothing unusual here. Each array slot contains a String reference that can be used in the usual ways. Here is a fragment that writes each slot's String (if there is one) to the monitor :
String[] strArray = new String[8] ; // combined statement . . . . . for (int j=0; j ___________ strArray.length; j++ ) { if ( strArray[j] != ___________ ) System.out.println( "Slot " + j + ": " + strArray[j] ); else System.out.println( "Slot " + j + ": " + "empty" ); }