package hello;
public class PeopleAndMoney {
public static void main(String[] args) {
// TODO Auto-generated method stub
double y=0.8;
People zhang=new People();
zhang.setMoney(8888);
A a=new A();
System.out.println("在方法f被调用之前对象zhang的money是:"+zhang.money+" y的值是"+y);
a.f(y,zhang);
System.out.println("在方法f被调用之后main方法中y的值仍然是:"+y);
System.out.println("在方法f被调用之后main方法中对象zhang的money是:"+zhang.money);
}
}
class People {
int money;
void setMoney(int n) {
money = n;
}
}
class A {
void f(double y, People p) {
y = y + 1;
p.setMoney(100);
System.out.println("参数y的值是:" + y);
System.out.println("参数对象p的money是:" + p.money);
}
}