I'm just learning Java for some research purposes. I have a question about the interface mechanism in Java. I don't know whether it is correct to understand interface as some sort of special abstract class; but I am confused which method "pr(int _i)" is it using when compiled:
public interface A {
int flagA=0;
void pr(int _i);
}
And another interface B like this:
public interface B extends A{
int flagB=0;
double pr(int _i);
}
And then I realized a class using interfaces A and B:
public class inter1 implements A,B {
void pr(int _i){...};
double pr(int _i){...};
}
It cannot be compiled correctly. Here will NOT form an override over interface A when I used interface B. But will the return type be enough to distinguish two methods?
I have already look up Bruce Eckel's Thinking in Java, but nothing helpful was found.
Thank you for your time!