<<< Common methods of the ArrayList class | Index | Another way to display the contents of a collection >>> |
// create an array list of type String ArrayList<String> codes = new ArrayList<>(); // add three strings codes.add( "mbdk" ); codes.add( "citr" ); codes.add( 0, "warp" ); // print the array list for ( int idx = 0; idx < codes.size(); ++idx ) { String code = codes.get( idx ); System.out.println( code ); }
Resulting output
warp mbdk citr
<<< Common methods of the ArrayList class | Index | Another way to display the contents of a collection >>> |