It says The Java ArrayList clone() method makes the shallow copy of an array list. But when I delete the value from the original list it is not reflected in the cloned list.
import java.util.*;  
 public class Test{  
     public static void main(String args[]){  
          ArrayList<String> list=new ArrayList<String>();
          list.add("Mango");    
          list.add("Apple");    
          list.add("Banana");    
          list.add("Grapes");         
          ArrayList<String> list2;    
          list2=(ArrayList)list.clone();
          list.remove(0);
          System.out.println(list); //[Apple, Banana, Grapes]
          System.out.println(list2); //[Mango, Apple, Banana, Grapes] 
    }  
}
When I compile this program it shows
Note: Test.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details
 
    