Solved

Given the Partial ArrayList Class Declaration Below, Select an Expression

Question 36

Multiple Choice

Given the partial ArrayList class declaration below, select an expression to complete the contains method. public class ArrayList
{
Private Object[] elements;
Private int currentSize;
Public ArrayList()
{
Final int INITIAL_SIZE = 10;
Elements = new Object[INITIAL_SIZE];
CurrentSize = 0;
}
Public boolean contains(Object item)
{
For (int i = 0; ________________ ; i++)
{
If (elements[i].equals(item) )
{
Return true;
}
}
Return false;
}
) ..
}


A) i < currentSize
B) i <= currentSize
C) i < elements.length
D) i <= elements.length

Correct Answer:

verifed

Verified

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

Related Questions