Solved

Insert the Missing Code in the Following Code Fragment

Question 72

Multiple Choice

Insert the missing code in the following code fragment. This fragment is intended to remove a node from the head of a linked list: public class LinkedList
{
) . .
Public Object removeFirst()
{
If (first == null) { ________________ }
Object element = first.data;
First = first.next; 1
Return element;
}
) . .
}


A) throw new NoSuchElementException() ;
B) throw new IllegalStateException() ;
C) throw new NullPointerException() ;
D) throw new IllegalArgumentException() ;

Correct Answer:

verifed

Verified

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

Related Questions