package com.liuc.test;
public class Assignment {
public static void main(String[] args) {
Tank tank1=new Tank();
Tank tank2=new Tank();
tank1.level=9;
tank2.level=47;
System.out.println("t1.level"+tank1.level+",t2.level"+tank2.level);
tank1=tank2;
System.out.println("t1.level"+tank1.level+",t2.level"+tank2.level);
tank1.level=27;
System.out.println("t1.level"+tank1.level+",t2.level"+tank2.level);
}
}
class Tank{
int level;
}
结果:
t1.level9,t2.level47
t1.level47,t2.level47
t1.level27,t2.level27