aspose file tools*
The moose likes Java in General and the fly likes help needed on Inner classes program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "help needed on Inner classes program" Watch "help needed on Inner classes program" New topic
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
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3220
    
  49

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 ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39865
    
  28
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.
 
Consider Paul's rocket mass heater.
 
subject: help needed on Inner classes program