Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. //create an object by passing in a name and age:
  2. PersonClass variable1 = new PersonClass("Mary", 32);
  3.  
  4. PersonClass variable2;
  5.  
  6. //Both variable2 and variable1 now reference the same object
  7. variable2 = variable1;
  8.  
  9.  
  10. PersonClass variable3 = new PersonClass("Andre", 45);
  11.  
  12. // variable1 now points to variable3
  13. variable1 = variable3;
  14.  
  15. //WHAT IS OUTPUT BY THIS?
  16. System.out.println(variable2);
  17. System.out.println(variable1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement