//File A.java package a; public class A { A(){ } public void print(){ System.out.println("A"); } } //File B.java package b; import a.*; public class B extends A { B(){ } public void print(){ System.out.println("B"); } public static void main(String[] args) { new B(); } }
Constructor in class A has default access so it cannot be invoked from other packages. If you extend from class A, it is mandatory to invoke its constructor (explicitly or implicitly).
SCJP 5.0 (91%), SCBCD 1.3 (94%), SCWCD 1.4 (88%)
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad: