I know that the following code is wrong because the modifier public
is missed in the header of the method m1()
in class B
. But i wonder "Why?!". Why the code causes a compile error if public
is missed.
Thanks in advance.
interface A{
void m1();
}
class B implements A{
void m1(){
System.out.println("m1");
}
}