Online Java Compiler By
JavaTpoint.com
import java.util.ArrayDeque; import java.util.Deque; public class JavaDequepeekLastExample3 { public static void main(String[] args) { Deque
deque = new ArrayDeque<>(); deque.offer(1); deque.offer(2); deque.offer(3); deque.offer(4); deque.offer(5); int val = deque.peekLast(); System.out.println("The last integer value is given as : "+val); System.out.println("The final deque is given as : "); for (Integer integer : deque) { System.out.println(integer); } } }
Output