Examlex

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.


Definitions:

Disturbances

Events or factors that disrupt the normal functioning or state of a system, environment, or individual.

Fatigue

A state of physical or mental weariness resulting from exertion.

Nondepressed People

Individuals who do not suffer from the symptoms of depression, characterized by a persistent feeling of sadness or a lack of interest in external stimuli.

Negative Thoughts

Negative thoughts are pessimistic or detrimental ideas or beliefs that can affect one's mood, self-esteem, and overall outlook on life.

Related Questions