raj chiru wrote:
In preceding code how to provide implementation of add() in Test class
implementation is nothing but writting the logic(coding) for a method
example
Eric Mission
Greenhorn
Joined: Apr 22, 2009
Posts: 22
posted
0
simple, you can't so, you don't. That isn't an issue when following the javabean convention...
to infinity and beyond
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
4
posted
0
You have a collision. Collisions between interface methods can always be resolved providing the following three conditions apply:
1: The methods have the same signature. (Otherwise it is overloading and not a collision at all).
2: The methods have compatible intent (see below).
3: The methods have the same return type. (You will have to check in the Java Language Specification for the exact details.)
You are violating no 3 here, and it will never compile.
This is overloadingAnd this is incompatible intentObviously the WackyArithmetic#add method is only suitable for jokes, but I challenge you to implement both those interfaces in accordance with their specifications given.
Have a look at these three add methods: note that the first is intentionally given a vague specification so both sub-interfaces can implement it differently, but still be compatible in intent. 123