假设现在有这么一个父类:
public class Person{ public Person(){} public String name = "tom"; public int age = 1int sex = 0; void showInfo(){ System.out.println(this.name); System.out.println(.age); System.out.println(.sex); } void seInfo(String name,int age,1)">int sex){ this.name = name; this.age = age; this.sex = sex; } }
有一个子类:
class Student extends Student(){ super(); } public String school; }
那么进行Student stu = new Student();的过程如下: