Java Deque pollLast() Method

The pollLast() method of Java Deque Interface is used to retrieve and remove the last element of the deque. The method may return null if the given deque is empty.

Syntax:

Parameter:

NA

Return:

The above method is used to return the tail of the deque. On the other hand, if the deque is empty, the method may return null.

Example 1

Test it Now

Output:

The last string is given as : World
The remaining deque is : [Hello,  ]

Example 2

Test it Now

Output:

The last float value is given as : 98.0
The remaining deque is : [24.0, 56.9]

Example 3

Test it Now

Output:

The LAST character value is given as : S
The final deque is given as : 
I
N
D
I
A
N
Next TopicJava Deque




Latest Courses