Shweta Dhaneshwar.<br />SCJP 1.4 90%
Consultant to SCJP team.<br />Co-designer of SCJD exam.<br />Co-author of "Complete Java 2 Certification Study Guide".<br />Author of "Ground-Up Java".
Originally posted by Philip Heller:
How do you figure out which version of an overridden method is actually called? Ignore the type of the reference. Look at the class of the object to which the reference points.
Originally posted by Philip Heller:
In your third question, I need to know how you invoked your application. Did you type "java Test" or "java Super"?
Since you're surprised by the result, I'm guessing you typed "java Test". Notice the declaration of main() in class Test. The arg is String, not String[]. So what gets called is the inherited version from Super.
Thanks and Regards, Amit Taneja
Originally posted by amit taneja:
"So what gets called is the inherited version from Super."
how can a static method of super be inherited in subclass ?
and we have also not called the method Super.main(String[]); either ?
bit confused ? ..pls clarify
RB
Thanks and Regards, Amit Taneja
Don't get me started about those stupid light bulbs. |