| Author |
help needed on Inner classes program
|
Naveen Megharaj
Ranch Hand
Joined: Feb 13, 2009
Posts: 39
|
|
The code goes like this
Above program produces the output as:
High
High
Low
But i was expecting it as:
High
High
Out
Since class C extends inner class -class B and overrides the 'runNOw()' method and hence a call to 'runNow() ' method on reference variable of type "B1" which points to an object of type C1 should produce the output as "Out". But its not doing so.....can anybody explain why.....?
|
 |
Devaka Cooray
Saloon Keeper
Joined: Jul 29, 2008
Posts: 2699
|
|
This question is from my ExamLab SCJP exam simulator. When posting questions again, please QuoteYourSources.
You are getting that output because Java is case-sensitive. In other words runNow() is not equivalent for runNOw()
Hint: ExamLab has a "Copy Program" button which can be used to copy the entire program in to the clipboard.
|
Author of ExamLab (Download) - the free mock exam kit for SCJP / OCPJP
Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32708
|
|
|
Precede the runNOw method with the @Override annotation and see what happens when you try to compile the class. And Devaka Cooray is correct about quoting sources.
|
 |
 |
|
|
subject: help needed on Inner classes program
|
|
|