Java Deque pop() MethodThe 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 1Test it NowOutput: The first fruit which has been removed is : Apple The final deque is given as : Guava Mango Pear Example 2Test it NowOutput: The first number which has been removed is : 67.0 The final deque is given as : 55.0 78.0 77.0 Example 3Test it NowOutput: The first character which has been removed is : a The final deque is given as : b c d Next TopicJava Deque |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India