Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reference Assignment

 
prakash praksh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please let me know what happens when at line no 1 and line no2. ?




 
John de Michele
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prakash:

Have you tried it? What do you think will happen?

John.
 
Nicolas Kal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prakash,

At line 1 (9 in the snipset) object 'o' references to the same object reference of p
At line2 (11 in the snipset) object 'o' references to the array reference of variable a in line 10

Regards,
Nicolas
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic