• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help needed on Inner classes program

 
Naveen Megharaj
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 4594
302
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49813
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic