Solved

Complete the Following Code

Question 18

Multiple Choice

Complete the following code:
/** Returns the next element in the queue.
Pre: index references the next element to access.
Post: index and count are incremented.
@return The element with subscript index
*/

Public E next() {
If (!hasNext() ) {
____
}
E returnValue = theData[index];
Index = (index + 1) % capacity;
Count++;
Return returnValue;
}


A) throw new NoSuchElementException() ;
B) throw new StackException() ;
C) throw new EmptyStackException() ;
D) throw new EmptyListException() ;

Correct Answer:

verifed

Verified

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

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents