Solved

Given the LinkedListStack Class Implementation Discussed in Section 16

Question 73

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

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