|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
That is why error occurs. Because sub class SHOULD implement the abstract methods of super class, unless the sub class is also abstract class.Samir Das wrote:It is to be noted here that access-modifier of absMethod() in Super class is default (no-access) and it should not be seen from any class that is in the different package like Accessing.java. Then why does this error occur??
Samir Das wrote:Changing packages doesn't work. The same compiler error still exists !!
Samir Das wrote:Changing packages doesn't work. The same compiler error still exists !!
Samir Das wrote:There are two classes here:
Accessing.java:
package access_modifier;
import access_modifier.accessed.*;
class Accessing extends Super{
public void absMethod(){}
public static void main(String... asd){
System.out.println(5);
}
}
Super.java:
package access_modifier.accessed;
abstract public class Super{
abstract void absMethod();
}
Now, if Accessing.java is compiled, an error has occurred implying that Accessing is not defined as abstract and did not override abstract method absMethod() of Super class. It is to be noted here that access-modifier of absMethod() in Super class is default (no-access) and it should not be seen from any any class that is in the different package like Accessing.java. Then why does this error occur??
SCJP 6.0