package sso;
class ConstructorMethod1 {
public ConstructorMethod1(){
System.
out.println(
"父类无参构造方法");
}
public ConstructorMethod1(
int i){
System.
out.println(
"父类带参构造方法");
}
}
class B extends ConstructorMethod1{
public B(
int i){
System.
out.println(
"子类有参构造方法");
}
public B(){
System.
out.println(
"子类无参构造方法");
}
public B(String a){
super(
2);
System.
out.println(
"调用父类有参的构造方法");
}
}
package sso;
public class Test1 {
public static void main(String[] args) {
B b=
new B();
B b1=
new B(
1);
B b2=
new B(
"a");
}
}