public class TestConstruct extends Parent{
public static void main(String[] args) {
TestConstruct tc = new TestConstruct("aaa");
}
TestConstruct(){
System.out.println("TestConstruct----");
}
TestConstruct(String str){
System.out.println("TestConstruct----" + str);
}
}
class Parent{
Parent(){
System.out.println("Parent----");
}
Parent(String str){
System.out.println("Parent----" + str);
}
}
执行结果:
Parent----
TestConstruct----aaa