java this中,当多个实例调用同一个方法时,this所代表的对象与调用方法的对象相反。第一次在csdn上提问,还没有搞到悬赏分,以后提问一定补上,谢谢各位大佬

public class Person {
public void jump(){
System.out.println("jump.....");
}
public void run(){
//this输出的引用顺序与调用run方法的引用顺序相反
System.out.println("this= " + this);
jump();
}
public static void main(String[] args) {
Person person = new Person();
Person person2 = new Person();
//没有按创建对象的顺序调用run方法
person2.run();
person.run();
}
}


问题解决的话,请点采纳

public class Person {
public void jump(){
System.out.println("jump.....");
}
public void run(){
//this输出的引用顺序与调用run方法的引用顺序相反
System.out.println("this= " + this);
jump();
}
public static void main(String[] args) {
Person person = new Person();
Person person2 = new Person();
System.out.println("this= " + person);
System.out.println("this= " + person2);
//没有按创建对象的顺序调用run方法
person2.run();
person.run();
}
}

this= Person@681a9515 //person
this= Person@3af49f1c //person2
this= Person@3af49f1c //person2
jump.....
this= Person@681a9515 //person
jump.....

我测试了你的程序,输出如上,没有你说的问题