首页上一页 1 下一页尾页 1 条记录 1/1页
为什么ch[1]的值能替换?
发表在Java图书答疑
2016-03-31
是否精华
是
否
版块置顶:
是
否
package com.lzw;
public class Ex55 {
String str=new String("Hi!");
char ch1[]={'a','b','c'};
public static void main(String args[]){
Ex55 ex=new Ex55();
ex.change(ex.str, ex.ch1);
System.out.print(ex.str+" ");
System.out.print(ex.ch1);
}
public void change(String str,char ch[]){
str="000";
[font color=#FF0000]ch[1]='z';
[/font]
}
}
public class Ex55 {
String str=new String("Hi!");
char ch1[]={'a','b','c'};
public static void main(String args[]){
Ex55 ex=new Ex55();
ex.change(ex.str, ex.ch1);
System.out.print(ex.str+" ");
System.out.print(ex.ch1);
}
public void change(String str,char ch[]){
str="000";
[font color=#FF0000]ch[1]='z';
[/font]
}
}