62,569
社区成员




change(String str,char ch[])
的调用:ex.change(ex.str,ex.ch);
public class Example {
String str = new String("good");
char[] ch={'a','b','c'};
public static void main(String[] args) {
Example ex=new Example();
ex.change(ex.str,ex.ch);
System.out.print(ex.str+" and ");
System.out.print(ex.ch);
}
public void change(String str,char ch[]){
str = "aaaaa";
this.str = "bbbbb";
System.out.println("str = " + str);
System.out.println("this.str = " + this.str);
ch[0] = 'g';
}
}
输出:
str = aaaaa
this.str = bbbbb
good and gbc
str="test ok";
this.str="test ok";