发现个好东西: 一个免费短链生成项目:“ https://www.isok.co”一个可以生成所有短链的服务,isok.co的这个含义能覆盖所有短链含义isok, 我试过了很不错,都可以试试
public class Person7 { String name; int age; public Person7(){ System.out.println("1.public Person7(){}" ); } } class Studentt extends Person7{ String school; public Studentt() { System.out.println("2.public Student(){}"); } }
/** * Created by xabcd on 2019/2/15. */ public class TestPerson7Student { public static void main(String[] args) { Studentt s = new Studentt(); } }
结果: 1.public Person7(){} 2.public Student(){} 自类在实例化时先调用父类中的无参构造方法再调用有参构造方法。 可以改在一个文件中:
/** * Created by xabcd on 2019/2/15. */ public class Person7 { String name; int age; public Person7(){ System.out.println("1.public Person7(){}" ); } } class Studentt extends Person7{ String school; public Studentt() { System.out.println("2.public Student(){}"); } public static void main(String[] args) { Studentt s = new Studentt(); } }