• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.....?
 
Sheriff
Posts: 7136
1360
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: 79249
377
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic