| Author |
constructor
|
sandeep Talari
Ranch Hand
Joined: Dec 24, 2007
Posts: 63
|
|
F:\javaprogs>javac B.java B.java:12: cannot find symbol symbol : constructor A() location: class A { ^ 1 error class A { A(int i , int y) { System.out.println("im in class A"); } } class B extends A { B(int x, int z) { System.out.println("im in class B"); } public static void main(String [] args) { B b = new B(12,12); } } [ May 27, 2008: Message edited by: sandeep Talari ] [ May 27, 2008: Message edited by: sandeep Talari ]
|
 |
Stevi Deter
Ranch Hand
Joined: Mar 22, 2008
Posts: 265
|
|
|
This fails for the same reasons that are discussed in this thread.
|
There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
|
 |
amitabh mehra
Ranch Hand
Joined: Dec 05, 2006
Posts: 98
|
|
If super doesn't appear as the first statement of a constructor body, the Java compiler inserts an implicit call -- super() -- to the immediate superclass constructor. So either you provider a default constructor in your super class or call super(x, z) as first statement in your subclass constructor.
|
 |
 |
|
|
subject: constructor
|
|
|