Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Override Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Override" Watch "Override" New topic
Author

Override

Saibabaa Pragada
Ranch Hand

Joined: Oct 24, 2010
Posts: 162
Hi, This is from ExamLab. I have given the question in the comments.
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 438

Whenever we are calling println method
then all the stuff that we are printing in it is calculated or executed first

see the code for explanation



Hope this helps
happy preparation


SCJP 6 [86%] June 30th, 2010
OCPWCD [84%] March 26th, 2013
If you find any post useful, click the "plus one" sign on the right
Stephen Davies
Ranch Hand

Joined: Jul 23, 2008
Posts: 352
Hi Saibabaa,

Prasad has done an excellent job of outlining what happens, however I had to go through it myself in order to fully grasp what is going on and I have tried to simplify, or at least re structure the comments, and re-implement the code, with more verbose naming conventions, for my peace of mind, to try to follow the logic. If it may help I've posted my version here. Anyone feel free to correct me or comment if I have got it wrong. My comments try to show my understanding of whats going on.



be a well encapsulated person, don't expose your privates, unless you public void getWife()!
Seema Kekre
Ranch Hand

Joined: Dec 02, 2010
Posts: 35
Thanks for your awesome explanation Prasad. I still had to go through this step by step. I broke it down into 2 steps:


OCPJP 6
Anchit Herredia
Greenhorn

Joined: Jul 15, 2009
Posts: 26
Prasad Kharkar wrote:Whenever we are calling println method
then all the stuff that we are printing in it is calculated or executed first

see the code for explanation...
...
Hope this helps
happy preparation


Superb answer, Prasad! Well done!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Override
 
Similar Threads
Question from Exam lab practice Exam 1 about polymorphism
examlab mockup 1 question
oo concept
what is this??? I m confused
strange behavior of overridden call