Campbell Ritchie wrote:Work out which order the methods are called in. You get as far as the first print statement and find the h field. Then what happens? Where is the value of h and what format is it stored in? Will the getH() call be executed before or after the + operator?
Campbell Ritchie wrote:Will the getH() call be executed before or after the + operator?
Pete Letkeman wrote:I recognize this, this is an Enthuware mock test question.
This has been discussed the following places by others.
Do any of the following posts help out?
https://coderanch.com/t/678147/certification/Enthuware https://coderanch.com/t/658010/certification/Explain-reason-output-Enthuware http://enthuware.com/forum/viewtopic.php?f=2&t=2075
Kelvin Okornoe wrote:Someone help me understand why?
Kelvin Okornoe wrote:b.h will print 4, Because variables are invoked using the reference type than the Object at runtime, and b.getH() will invoke the Beta version of the method at runtime. When it gets to which variable is printed in class Beta. Beta's variable h gets printed and returned.
Please correct me if am wrong!.