import java.util.*; class UseMyArrayLists1 // Demonstrates changing all occurrences of an integer in a // MyArrayList1 object to another integer destructively, // showing difference between aliasing and copying. { public static void main(String[] args) throws Exception { Scanner input = new Scanner(System.in); System.out.println("Enter some numbers (all on one line):"); String line = input.nextLine(); String[] numbers = line.split(" "); MyArrayList1 a = new MyArrayList1(numbers.length); for(int i=0; i b=a; MyArrayList1 c=copy(a); System.out.println("\nThe MyArrayList1 object is "+a); System.out.println("The MyArrayList1 object viewed through its alias is "+b); System.out.println("The copy of the MyArrayList1 object is "+c); System.out.print("\nEnter two numbers: "); Integer p = input.nextInt(), q=input.nextInt(); System.out.println("Change "+p+" to "+q+" in the MyArrayList1 object"); change(a,p,q); System.out.println("\nThe MyArrayList1 object is now "+a); System.out.println("The MyArrayList1 viewed through its alias is now "+b); System.out.println("The copy of the MyArrayList1 object is now "+c); } public static MyArrayList1 copy(MyArrayList1 a) { MyArrayList1 b = new MyArrayList1(a.size()); for(int i=0; i void change(MyArrayList1 a,T m,T n) { for(int i=0; i