Java ArrayDeque add element

Introduction

To add element to ArrayDeque in Java

arrayDeque.add(object);

Full source

import java.util.ArrayDeque; 
 
public class Main { 
  public static void main(String args[]) { 
    ArrayDeque<String> adq = new ArrayDeque<String>(); 
     /*from w w w  .  jav a2  s . co m*/
    // Use an ArrayDeque like a stack.
    adq.push("CSS"); 
    adq.push("HTML");  
    adq.push("Java"); 
    adq.push("Javascript"); 
    adq.push("SQL"); 
 
    System.out.println(adq);
  } 
}



PreviousNext

Related