packagecom.oop.Demo05;publicclassPerson{protectedString name ="明";publicPerson(){System.out.println("Person无参构造执行了");}publicvoidprint(){System.out.println("Person");}}
packagecom.oop.Demo05;publicclassStudentextendsPerson{privateString name ="小明";publicStudent(){super();// this(); 不可以同时调用System.out.println("Student无参构造执行了");}publicvoidprint(){System.out.println("Student");}publicvoidtest1(){print();//Studentthis.print();//Studentsuper.print();//Person}publicvoidtest(String name){System.out.println(name);//王小明System.out.println(this.name);//小明System.out.println(super.name);//明}}