当前位置:编程学习 > JAVA >>

java对象方法,求高手详细解释

public class Test { int age = 20; public void change(Test people){ people = new Test(); people.age = 50; } public static void main(String[] args) { Test t = new Test(); int age = t.age; System.out.println(age); t.change(t); int age2 = t.age; System.out.println(age2); } } 方法中的,people = new Test(),, 能不能解释一下 这个形式参数也可以生成实例?通常new一个对象前面加类名,为什么这个没有加呢?还有就是t.change(t); 这个不太理解,希望高人解释一下
追问:people不是形式参数吗?怎么可以创建对象啊?
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,