Solved

Given the Partial LinkedList Class Declaration Below, Select a Statement

Question 95

Multiple Choice

Given the partial LinkedList class declaration below, select a statement to complete the size method, which is designed to return the number of list elements. public class LinkedList
{
Class Node
{
Public Object data;
Public Node next;
}
Private Node first;
) . .
Public int size()
{
Int count = 0;
Node temp = first;
While (temp != null)
{
Count++;
_____________________
}
Return count;
}
}


A) temp = temp.next;
B) temp = first.next;
C) first = temp.next;
D) first = first.next;

Correct Answer:

verifed

Verified

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

Related Questions