this代表对当前对象的一个引用。
public class Person {
//哪个对象调用了该方法,this就是哪个对象
public void printInfo(){
System.out.println(this);
}
public static void main(String[] args) {
Person person = new Person();
System.out.println(person);
person.printInfo();
}
}
this代表对当前对象的一个引用。
public class Person {
}