The interface Deque can have array based and linked implemen
Solution
Hi buddy, Please find the below java program. I\'ve added comments for your better understanding
import java.io.File;
 import java.io.FileNotFoundException;
 import java.util.*;
 import java.util.ArrayList;
 
 class ArrayDequeue implements Dequeue{
     private Object data[];
     private int front,rear,size,capacity;
     public ArrayDequeue(){
         capacity = 1000;
         data = new Object[capacity];
         front = size = 0;
         rear = 1;
     }
     public void addRear(Object obj){
         //Add the object to the end of the Dequeue.
         data[rear-1] = obj;
         //Increment rear
         rear++;
         //Increment the size of Dequeue
         size++;
     }
 }
class DNode{
     private Object data;
     private DNode prev,next;
     //This Constructor sets the data
     public DNode(Object data){
         this.data = data;
     }
     //This method returns the data
     public Object getNode(){
         return this.data;
     }
 }
class LinkedDequeue implements Dequeue{
     private DNode front,rear;
     private int size;
     public LinkedDequeue(){
         front = rear = null;
         size = 0;
     }
     public void addRear(Object obj){
         //Create a new Node
         DNode d = new DNode(obj);
         rear.next = d;
         d.prev = rear;
         rear = d;
         //If front is null , then front and rear are the same node
         if(front==null){
             front = rear;
         }
         //Increment the size;
         size++;
     }
 }
 class Main {
   
     public static void main (String[]args) throws FileNotFoundException {
     }
 }


