Suppose now that there is such a class:
public class Person{ public Person(){} String name = "tom"; int age = 1; int sex = 0; public void showInfo(){ System.out.println(this.name); System.out.println(this.age); System.out.println(this.sex); } public void seInfo(String name, int age, int sex){ this.name = name; this.age = age; this.sex = sex; } }
Person p = new Person();
So the whole object creation process is as follows: