Not a minute ago was a friend of mine here, and I was trying to explain to him some basics about Java, because he desires to do well in a test he has to take as part of the process of applying for a Job, anyways .......................
He made think hard about something I hadn't thought before, and that is:
What happens when you have a class that extends another class, that has a method that has the same name, return type and arguments as a method defined in an Interface that's also implemented by the extending class ?
like this I suppose:
It's really odd code I'd say. it even compiles.... but it's totally misleading, Why it doesn't give any compiler errors?
As usual thanks for your time answering this question, Best Regards, Jose
Its not at all misleading,the above line has nothing to do with class A,
all parameters point to class B
from this line line, we mean to convey
class B extends A and
class B implements Inter ----------
I hope that is what you feel misleading.
..............................<br />Exceptions are a part of possibility<br />Errors are a part of truth<br />................................
Joined: May 28, 2007
Oh, Good day to y'all How are you Jeanne?
I suppose that if you put it in that way, then it's not misleading anymore.
I needed to read that!
And by the way, the misleading part I suppose would be seeing an Implementing class, that in this case should have at least one method in it, but it doesn't appear to have it, because it's not visually there. (something like that)
Have a nice day! Jose
subject: Curious case about inheritance & Interface