I have two Java interfaces and one implementing class.
(I have used Eclipse to run the program directly, and I did not try to check any compiler warning et cetera by
In this situation, there is no issue because both interfaces have same method signature. But What about this ?
interface Animal {
public void eat() throws IOException;
}
interface Plants {
public void eat() throws NullPointerException;
}
Which one is choosen by the compiler ? Why does it get error below code ?
public class Test implements Animal, Plants {
public void eat() throws IOException {
}
}
Compiler says : Exception IOException is not compatible with throws clause in Plants.eat()