If two interfaces each declare a method with the same name and argument list, but different return types and/or incompatible exception declarations, then a single class may not implement both those interfaces. This is explicitly pointed out in the Java Language Specification.
One thing you can do is implement just one interface, and use an "adapter" method to provide a "view" of an object that implements the second interface. An inner class is ideal for this, since it has access to the members of the outer class.
You somehow posted your question 3 times. Please try to be more careful. I have removed two of them.
It would help if you posted the EXACT error message you are getting, not a paraphrase of what it sort of said.
It would ALSO help if you posted the relevant section of your actual code, not a pseudo-version of what is kind of looks like.
Now, having said all that...
IF what you mean is that interface 1 has a method like
public long a();
and interface 2 has a method like
public int a();
you're in trouble. java uses the name and parameters to determine what method to call (this is called the 'signature' of the method), not a return type. If you have two methods that have the same signature, but return different things, java can't tell which one you are trying to call.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database