I had been through this query before asking this question.
In class Window we have constructor with default direct access level package private but not private as shown below:
Window() throws HeadlessException {
GraphicsEnvironment.checkHeadless();
init((GraphicsConfiguration)null);
}
With class dummy inheriting class Window,
import java.awt.*;
public class dummy extends Window{
dummy() {
}
}
I see this error: Implicit super constructor Window() is not visible. Must explicitly invoke another constructor
I designed non-public class with zero-arg constructor having default direct access level package private and the subclass constructor invokes zero-arg Superclass constructor without any error.
I would like to understand,
Why does the compiler show this error despite the direct access level to the constructor Window(){} is package private?
Note: I am using jdk 1.6
Aucun commentaire:
Enregistrer un commentaire