Solved

The ArrayList Method IndexOf Has the Following API

Question 69

Short Answer

The ArrayList method indexOf has the following API:
public int indexOf( HYPERLINK "http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html" \o "class in java.lang" Object o)
Return the index of the first occurrence of o in this list or -1 if this list does not contain o.
ArrayList cities = new ArrayList( );
cities.add( "Baltimore" );
// more statements adding cities to the ArrayList cities
Use indexOf to retrieve the index of the city New York in cities (it may or may not be there) and assign the result to a variable of your choice.

Correct Answer:

verifed

Verified

int indexO...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions