// MiscellaneousArrayList.java (c) 2004 Kari Laitinen // www.naturalprogramming.com // 2004-09-26 File created. // 2005-05-28 Last modification. import java.util.ArrayList ; class MiscellaneousArrayList { public static void main( String[] not_in_use ) { ArrayList miscellaneous_objects = new ArrayList() ; miscellaneous_objects.add( 555 ) ; miscellaneous_objects.add( 66.77 ) ; miscellaneous_objects.add( "This is a string literal." ) ; miscellaneous_objects.add( new Date( "03.02.2004" ) ) ; System.out.print( "\n Substring is: " + ((String) miscellaneous_objects.get( 2 )).substring( 0, 3 ) + "\n" ) ; for ( int object_index = 0 ; object_index < miscellaneous_objects.size() ; object_index ++ ) { System.out.print( "\n " + miscellaneous_objects.get( object_index ) ) ; } System.out.print( "\n" ) ; } }