aspose file tools*
The moose likes Java in General and the fly likes Why don't I have an error here? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Why don Watch "Why don New topic
Author

Why don't I have an error here?

Andrew Stallard
Ranch Hand

Joined: Mar 06, 2010
Posts: 33
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?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Probably, the *TestClass* implemented the missing method
Andrew Stallard
Ranch Hand

Joined: Mar 06, 2010
Posts: 33
Here is TestClass. he method do SomethingElse() has not been implemented.



Thanks anyway
bhanu chowdary
Ranch Hand

Joined: Mar 09, 2010
Posts: 256
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

Joined: Mar 06, 2010
Posts: 33


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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why don't I have an error here?
 
Similar Threads
interface help
problem with overloading
Wrapper Class ?
Reflection