This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes A class extending a class and implementing an interface with same methods ? 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 » Beginning Java
Bookmark "A class extending a class and implementing an interface with same methods ?" Watch "A class extending a class and implementing an interface with same methods ?" New topic
Author

A class extending a class and implementing an interface with same methods ?

K Srinivasan
Ranch Hand

Joined: Mar 08, 2010
Posts: 34
if a class extends another class and implements an interface both with the same method , which function will it implement ??

eg:



which show() does c implement ??

thanks.
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
The important thing is that the rules for the implementation of interfaces and abstract classes have been obeyed.

So, if you do


or



both will do the same thing...


JDBCSupport - An easy to use, light-weight JDBC framework -
John de Michele
Rancher

Joined: Mar 09, 2009
Posts: 600
'Albus':

Aren't you dead? You probably should change your username to your real name. Fake names are against the rules, and the moderators will get on your case.

John.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

albus dumbeldore wrote:which show() does c implement ??

From a pragmatic standpoint, what's the difference? If the signatures are the same, the implementing subclass will be an instance of both the superclass and interface (unless I'm misunderstanding something).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A class extending a class and implementing an interface with same methods ?
 
Similar Threads
Doubt regarding interface implementation
doubt interface, abstract class
Classes: Abstract And Interface
How do I extend and implement same method from an abstract class and interface