Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayDeque;
import java.util.Deque;

public class Main {
    public static void main(String[] args) {

        ArrayDeque<Integer> deque1 = new ArrayDeque<Integer>(8);

        deque1.add(3);
        deque1.add(2);
        deque1.add(1);
        deque1.add(18);

        // clone the first deque,
        Deque<Integer> deque2 = deque1.clone();

        // print all the elements available in deque2
        System.out.println(deque2);
    }
}