//[a,b] 10 [a] 10 [a,b] 10 //[a,b] 10 [a] 10 [a,b] 10 //[a,b] 10 0x321412 0x12341234 // 7 4 2 //[a,b,c] 1010 [a,b,c] 1010 [a,b,c] 10 [a,b,c] 1010 [a,b,c] 10 //[a,b,c] 1010 [a,b] 10 [a,b] 10 [a,b] 1010 [a,b] 10 //[a,b,c] 1010 [a,b,c] 1010 [a,b,c] 10 [a,b,c] 1010 [a,b] 10 // 1 2 2 5 1 import java.util.*; class SimpleExample { ArrayList s; int y; SimpleExample(ArrayList s, int y) { this.s = s; this.y = y; } public static void main(String [] args) { ArrayList a = new ArrayList(); a.add(new String("a")); a.add(new String("b")); ArrayList b = (ArrayList)(a.clone()); ArrayList c = a; int y = 10; SimpleExample s1 = new SimpleExample(a,y); SimpleExample s2 = new SimpleExample(b,y); SimpleExample s3 = new SimpleExample(c,y); // System.out.println(s1); //System.out.println(s2); //System.out.println(s3); a.add(new String("c")); y=y+1000; System.out.println(s1); System.out.println(s2); System.out.println(s3); } public String toString() { return "" + s + " " + y; } }