×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Added: May 5, 2021 10:32 AM
Views: 3969
Tags: collections
  1.     public static void main(String[] args) {
  2.  
  3.         ArrayList<String> colors = new ArrayList<>();
  4.  
  5.         colors.add("Red");
  6.         colors.add("Green");
  7.         colors.add("Orange");
  8.         colors.add("White");
  9.         colors.add("Black");
  10.  
  11.         colors.add(0, "Yellow");
  12.         colors.add(5, "Cyan");
  13.  
  14.         System.out.println(colors);
  15.     }