76
Java Deque pop() Method
The pop() method of Java Deque interface is used to pop an element from the given stack represented by this deque. We can also say that the above method removes and return the first element of the deque. The above method is similar to removeFirst() method.
Syntax:
Parameter:
NA
Return:
The above method is used to return the element at the front of the given deque.
Throw:
NoSuchElementException– If the given deque is empty.
Example 1
Output:
The first fruit which has been removed is : Apple The final deque is given as : Guava Mango Pear
Example 2
Output:
The first number which has been removed is : 67.0 The final deque is given as : 55.0 78.0 77.0
Example 3
Output:
The first character which has been removed is : a The final deque is given as : b c d
Next TopicJava Deque