// ArrayDemo.java (c) 2002-2004 Kari Laitinen // http://www.naturalprogramming.com // 2004-10-10 File created. // 2004-10-10 Last modification. // The corresponding program in my C++ book has name array.cpp. class ArrayDemo { public static void main( String[] not_in_use ) { int[] array_of_integers = new int[ 50 ] ; int integer_index ; array_of_integers[ 0 ] = 333 ; array_of_integers[ 1 ] = 33 ; array_of_integers[ 2 ] = 3 ; array_of_integers[ 3 ] = array_of_integers[ 2 ] + 2 ; for ( integer_index = 4 ; integer_index < 50 ; integer_index ++ ) { array_of_integers[ integer_index ] = array_of_integers[ integer_index - 1 ] + 2 ; } System.out.print( "\n The contents of \"array_of_integers\" is:\n" ) ; for ( integer_index = 0 ; integer_index < 50 ; integer_index ++ ) { if ( ( integer_index % 10 ) == 0 ) { System.out.print( "\n" ) ; } System.out.printf( "%5d", array_of_integers[ integer_index ] ) ; } } }