What is the result?

Given:

What is the result?

Given:

What is the result?

A.
Three

B.
One

C.
Compilation fails.

D.
The program runs, but prints no output.

Explanation:

push
void push(E e)
Pushes an element onto the stack represented by this deque (in other words, at the head of this
deque) if it ispossible to do so immediately without violating capacity restrictions, returning true
upon success and throwingan IllegalStateException if no space is currently available.
This method is equivalent to addFirst(E).
pop
E pop()
Pops an element from the stack represented by this deque. In other words, removes and returns
the firstelement of this deque.
This method is equivalent to removeFirst().
Returns:
the element at the front of this deque (which is the top of the stack represented by this deque)
Throws:
NoSuchElementException – if this deque is empty



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Humberto Bañuelos Flores

Humberto Bañuelos Flores

public static void main(String[] args) {
Deque deque=new ArrayDeque();
deque.add(“One”);
deque.add(“Two”);
deque.add(“Three”);
System.out.println(deque.pop());
}

//One

FF

FF

yup I got one as well