This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, Well it really is worth you having a look in the FAQ to see if there is any information about Interfaces there, and to also check the Sun java site for information (http://java.sun.com)
<edit> Having read your post again, I think the reason you are getting the error is because the method is named m1 in both interfaces, and the compilor dosnt know which interface's method (m1) you are trying to implement.
You cant have two methods named the same in one class unless you are overloading the method, ie changing the parameter list.
Hope that helps G
[ July 04, 2007: Message edited by: Gavin Tranter ]
[ July 04, 2007: Message edited by: Gavin Tranter ] [ July 04, 2007: Message edited by: Gavin Tranter ]
You could easily implement two interfaces that declare identical signatures. When somebody uses your class, the interfaces promise the method will be there, and sure enough it is. This will surely confuse people if the two interfaces document different meanings for the signature. Say InterfaceA says "left() returns true if you should turn left now" and InterfaceB says "left() returns true if this object was left behind" and InterfaceC says "left() returns true if this object is a liberal".
But, your problem came about because the two interfaces have similar signatures that are not quite identical. If you implemented both, you'd have a duplicate method name because return type is not part of the unique method identifier. If you didn't implement both, you'd fail the contract on one interface. [ July 04, 2007: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi