File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing variables inside method

 
Romeo Ranjan
Ranch Hand
Posts: 95
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
source: irix technologies



The answer is 55667766. i can trace the answer upto 556677,but i am not sure why System.out.print( voo.doo.doolet ); gives 66 in the end?

Thanks in advance
 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The secret is in line number 7, when doo = new Doo( ); is executed, the doo in voolish method starts pointing to a different object of type Doo, so the actual doo object passed to the method isn't effected when we set doo.doolet to 77. Read this, it will clear your doubts...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic