Java Deque removeLast() MethodLast Updated : 17 Mar 2025 The removeLast() method of Java Deque interface is used to retrieve and removes the last element of the given deque. The above method is different from the pollLast() method such that it throws an exception if the given deque is empty. Syntax:Parameter:NA Return:The above method is used to return the tail of the given deque. Throw:NoSuchElementException- If the given deque is empty. Example 1Output: The value that needs to be removed is : World The final deque is : Welcome to my Example 2Output: The value that needs to be removed is : E The final deque is : W E B S I T Example 3Output: The value that needs to be removed is : 98.7 The final deque is : 55.9 22.5 77.0 Next TopicJava Deque |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India