Solved

Given the LinkedListStack Class Implementation Discussed in Section 16

Question 26

Multiple Choice

Given the LinkedListStack class implementation discussed in section 16.3 (partially shown below) , select the statement(s) to complete the peek method. public class LinkedListStack
{
Private Node first;
Public LinkedListStack()
{
First = null;
}
Public Object peek()
{
If (empty() )
{
Throw new NoSuchElementException() ;
}
_____________________________
}
) ..
}


A) Object value = first.data;
First = first.next;
Return value;
B) first = first.next;
Return first.data;
C) return first;
D) return first.data;

Correct Answer:

verifed

Verified

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

Related Questions