×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Clifton Foster
Added: May 31, 2016 2:03 AM
Modified: May 31, 2016 2:04 AM
Views: 8
Tags: list
Create and modify a simple list.
  1. import java.util.*;
  2.  
  3. public class ListCountries{
  4.  
  5.   public static void main(String[] args){
  6.  
  7.     List list = new ArrayList();
  8.  
  9.     list.add("Albania");
  10.     list.add("Qatar");
  11.     list.add("Estonia");
  12.     System.out.println(list.toString());
  13.  
  14.     list.remove(0);
  15.     System.out.println(list.toString());
  16.  
  17.     list.add("Bulgaria");
  18.     System.out.println(list.toString());
  19.   }
  20. }