class Src {
public int writenByLx;
public int n=5;
public void decreaseValue(){
n--;
}
public Src() {
writenByLx=0;
}
}
class Dis{
public Src m;
public int a;
public Dis(Src im) {
m=im;
a=m.n;
}
public void getV(){
if(m.n!=a)
System.out.println("n in Src has been changed");
System.out.println(m.n);
}
}
public class WorkRun {
public static void main(String[] args) {
Src s0;
s0=new Src();
Dis s1;
s1=new Dis(s0);
s0.decreaseValue();
s1.getV();
}
}
编程作业——消息
最新推荐文章于 2024-08-18 21:36:31 发布