// demonstrate ArrayList with generics
import java.util.ArrayList;
// ...

// note use of <String> on both sides of the =
ArrayList<String> al = new ArrayList<String>( 3 );
al.add( "bear" );
al.add( "cougar" );
al.add( "wolverine" );

// no (String) cast needed
String animal = al.get( 1 );

// converting an ArrayList to an array, no (String[]) cast needed.
String[] predators = al.toArray( new String[ al.size() ] );

// Iterating over an ArrayList
for ( String predator : al )
   {
    out.println( predator );
   }