File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes how to implement two different definition for class which implements two interface with same method Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "how to implement two different definition for class which implements two interface with same method" Watch "how to implement two different definition for class which implements two interface with same method" New topic
Author

how to implement two different definition for class which implements two interface with same method

Sandeep Kethepalle
Greenhorn

Joined: Sep 16, 2010
Posts: 1
Hi

I have an interface called Interface1



I have another interaface called Interface2



I have a class which implements two interface which should have different definitions for two methods


example






It is giving me compilation error .But i need to implement in this same manner.I have been fiddling with last 2 days .Can anyone please help me

Thanks in advance

Regards
K.Sandeep
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

Welcome to the ranch!

You can only have one display() method. You make that one method do what both interfaces specify. If that's not possible for any reason then you simply cannot do this.
Also, please UseCodeTags next time. See how much easier it is to read my piece of code?


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32654
    
    4
Rob Prime wrote: . . . Also, please UseCodeTags . . .
Since he's new, I'll edit his code and see how much better it looks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to implement two different definition for class which implements two interface with same method
 
Similar Threads
Which of the above two interfaces would be invoked?
methods with same signature, different return types in interfaces conflict in class
Questions for you
anonymous inner classes
Which concept of OOPs is this?