Add() Method : Add element in ArrayDeque in Java

   

Declaration :

Explanation :

Purpose The java.util.ArrayDeque.add(E e) method inserts the specified element E at the end of the deque. This method is equivalent to addLast(E).
Parameters e ===> The element to be added in the deque.
Return Value This method returns true if given element is added successully into the deque otherwise it returns false.
Exception NullPointerException — if the specified element is null.

Java Program : Example

Below example will explain java.util.ArrayDeque.add(E) method.

Output of Program :