Online Java Compiler By
JavaTpoint.com
import java.util.ArrayDeque; import java.util.Deque; public class JavaDequegetLastExample1 { public static void main(String[] args) { Deque
deque = new ArrayDeque<>(); deque.add("FAT"); deque.add("CAO"); deque.add("JAVA"); deque.add("DBMS"); System.out.println("The final queue is : "+deque); String val = deque.getLast(); System.out.println("The required answer : "+val); } }
Output