Given the partial ArrayList class declaration below, select an expression to complete the empty method, which is designed to return true if the list contains no elements. 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 empty()
{
Return ________________________ ;
}
}
A) elements.length == 0
B) elements.currentSize == 0
C) elements[0] == null
D) currentSize == 0
Correct Answer:
Verified
Q25: In a linked list data structure, when
Q37: Which of the following actions must be
Q38: Using the textbook's implementation of a linked
Q38: Which of the following actions must be
Q41: Given the partial LinkedList and LinkedListIterator class
Q43: Reading or writing an array list element
Q45: Given the partial ArrayList class declaration below,
Q46: Array list operations that were studied included
Q47: When considering the reallocation operation for a
Q48: Which of the following statements about array
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents