程序总是报错::::什么原因造成的
class Example1
{
String str=new String("good");
char[]ch={'a','b','c'};
public void change(String str,char[] ch){
str="test ok!";
ch[0]='g';
System.out.print(str);
System.out.println(ch);
}
}
class Example
{
public static void main(String args[]){
Example1 ex=new Example1();
ex.change(ex.str,ex.ch);
System.out.print(ex.str+" and ");
System.out.println(ex.ch);
}
}
|