- public class User {
- String geo;
- public String getGeo() {
- return geo;
- }
- public void setGeo(String geo) {
- this.geo = geo;
- }
- public User(String s){
- geo = s;
- }
- void f(User d){
- d = new User("d1");
- d.setGeo("gg");
- }
- public static void main(String[] args) {
- User dddd = new User("dddd");
- User qq = new User("qq");
- qq.f(dddd);
- System.out.println(dddd.getGeo());
- System.out.println(qq.getGeo());
- }
- }
复制代码输出是: dddd qq 请问高手,为什么是dddd而不是gg,JVM在new对象的时候都做了啥?
|