Solved

Insert the Missing Code in the Following Code Fragment

Question 67

Multiple Choice

Insert the missing code in the following code fragment. This fragment is intended to add a new node to the head of a linked list:
Public class LinkedList
{
) . .
Public void addFirst(Object element)
{
Node newNode = new Node() ; 1
NewNode.data = element;
_________ 2
_________ 3
}
) . .
}


A) first = newNode;
NewNode.next = first;
B) newNode.next = first;
First = newNode;
C) first = newNode.next;
NewNode.next = first;
D) first = newNode.next;
NewNode = first;

Correct Answer:

verifed

Verified

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

Related Questions