• 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

Why don't I have an error here?

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now, I have this interface called JohnnyNumber:



This interface is implemented by a class called TestOne:



Now, I do not use the method doSomethingElse() in the class even though it is in the interface, but the program runs just fine. What is going on?
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably, the *TestClass* implemented the missing method
 
Andrew Stallard
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is TestClass. he method do SomethingElse() has not been implemented.



Thanks anyway
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have just tested with your code and the compiler is throwing an error.

"The type TestOne must implement the inherited abstract method JohnnyNumber.doSomethingElse()".

Could you please check again.
 
Andrew Stallard
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


OK, I have figured it out. I changed (and recompiled) the interface when I added the additional method. However, I did not recompile the TestOne class. (I didn't think I had too because I changed no code.) Upon recompiling, the error appears.

Sorry
reply
    Bookmark Topic Watch Topic
  • New Topic