6.4 Hypothesize what will happen when the following code fragment is run, and then test your hypothesis:
ArrayList original = new ArrayList();
original.add ("yes");
ArrayList copy = (ArrayList)original.clone();
System.out.println (copy.get (0));
Hint: This exercise illustrates why the copy constructor is superior to the clone() method.
 
 
View Solution
 
 
 
<< Back Next >>