Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Write a description of class TestArray here.
- *
- * @author Dov Triestman
- */
- public class TestArray
- {
- int[] array1 = new int[]{2,3,5,7,9,11,13,17,19};
- int[] array2 = array1;
- /**
- * Constructor for objects of class TestArray
- */
- public TestArray()
- {
- System.out.println("Printing array1");
- for(int i=0; i<array1.length; i++)
- System.out.println(array1[i]);
- System.out.println("Printing array2 after changes");
- for(int i=0; i<array1.length; i++)
- {
- if(i%2 == 0)
- {
- array2[i] = i;
- System.out.println(array2[i]);
- }
- else
- System.out.println(array2[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement