• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

help needed on Inner classes program

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.....?
 
Marshal
Posts: 7406
1423
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 80666
478
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic