//super
//1.子类的构造函数中会隐式的调用super();如果父类中没有无参的构造函数,程序会出错
//2.如果显示的写出super(),则必须在构造函数的第一句
class A
{
int i,j;
public A(int i,int j)
{
this.i = i;
this.j = j;
}
}
class B extends A
{
int k;
public B(int i,int j, int k)
{
super(i,j);
this.k = k;
}
}
class test
{
public static void main(String[] args)
{
B bb = new B(2,3,5);
System.out.printf("%d,%d,%d\n", bb.i,bb.j,bb.k);
}
}
//1.子类的构造函数中会隐式的调用super();如果父类中没有无参的构造函数,程序会出错
//2.如果显示的写出super(),则必须在构造函数的第一句
class A
{
int i,j;
public A(int i,int j)
{
this.i = i;
this.j = j;
}
}
class B extends A
{
int k;
public B(int i,int j, int k)
{
super(i,j);
this.k = k;
}
}
class test
{
public static void main(String[] args)
{
B bb = new B(2,3,5);
System.out.printf("%d,%d,%d\n", bb.i,bb.j,bb.k);
}
}