void myMethod( String... animals )
{
for ( String animal : animals )
{
out.println( animal );
}
}
myMethod( "tiger", "lion", "hippopotamus" );
myMethod( "tiger" );
myMethod( );
String[] someStringArray = getValues();
myMethod( someStringArray );
void myOldMethod( String[] animals )
{
for ( int i=0; i< animals.length; i++ )
{
out.println( animals[i] );
}
}
myOldMethod( new String[] {"tiger", "lion", "hippopotamus"} );
myOldMethod( new String[] {"tiger"} );
myOldMethod( new String[0] );
String[] someStringArray = getValues();
myOldMethod( someStringArray );