Maybe the question have many people ask, but I still don't know how to get the answer.
I have A, B, C class.
C extends B, B extends A.
the main method in the C class.
If I want to call A constructor method with parameters in C class,
how can I do?
thanks you very much.
A class
public class A {
public A() {
System.out.println("A construtor");
}
public A(int a, int b)
{
System.out.println("A.a:"+ a + "/B.b:"+b);
}
}
B class
public class B extends A{
public B() {
System.out.println("B construtor");
}
public B(int a, int b) {
System.out.println("B.a:" + a + "/B.b:" + b);
}
}
C class
public class C extends B{
public static void main(String[] str)
{
C c = new C();
}
public C() {
// super(1,2);
// how to call A constructor with parameters
System.out.println("C constructor");
}
}