Question: Choose the best method / class from the dropdown menu. 1 ) Print elements in a queue. while ( ! queue.empty ( ) ) {
Choose thebestmethodclass from the dropdown menu.
Print elements in a queue.
whilequeue.empty
get but don't delete the element yet
Integer current queue.blank;
System.out.printlncurrent;
delete the element
queue.blank;
The method inblankshould be: Select push "peek "poll "get "offer "pop "remove
The method inblankshould be: Select pop "offer "peek "push "poll "remove "get
Print elements in a stack.
whilestack.isEmpty
get but don't delete the element yet
Integer current stack.blank;
System.out.printlncurrent;
delete the element
stack.blank;
The method inblankshould be: Select pop "get "remove "poll "peek "offer "push
The method inblankshould be: Select poll "remove "pop "push "get "peek "offer
To print the elements from thefirst to last, should use Select stack "queue"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
