Consider the following classes:
class A {
void print() {
System.out.println("A");
}
}
class B extends A implements C {
}
public interface C {
void print();
}
I get this error:
The inherited method A.print() cannot hide the public abstract method in C
Now, I understand that print()
must be public in order the eliminate the compilation error, but what's the reason behind this?