public报错 (已经解决)
程序代码:
package huhu_520; class testobject { private String name; public void setName(String pname) { name = pname; } public String getName() { return name; } } public class testit { private void modify(testobject ta, testobject tb) { ta.setName("xyz"); tb.setName("uvw"); System.out.println("in test..."); System.out.println("ta.getName()=" + ta.getName()); System.out.println("tb.getName()=" + tb.getName()); } public static void main(String[] args) { testobject ta = new testobject(); testobject tb = new testobject(); testit tc = new testit(); ta.setName("abc"); tb.setName("def"); System.out.println("before test...."); System.out.println("ta.getName()=" + ta.getName()); System.out.println("tb.getName()=" + tb.getName()); tc.modify(ta, tb); System.out.println("after test..."); System.out.println("ta.getName()=" + ta.getName()); System.out.println("tb.getName()=" + tb.getName()); } }
自己对程序的结构不是很清楚,希望高手帮我解释下~~~~!
[[it] 本帖最后由 hanzhu3366 于 2008-5-17 00:48 编辑 [/it]]