假设现在有这么一个类:
public class Person{ public Person(){} String name = "tom"; int age = 1int sex = 0void 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; } }
Person p = new Person();
那么整个对象的创建过程如下: