public class Mystery {
public static void main(String[] args ){
Changer c =new Changer();
c.method(args);
System.out.println(args[0]+""+args[1]);
}
static class Changer{
void method(String[] s){
String temp=s[0];
s[0]=s[1];
s[1]=temp;
}
}
}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at test4.Mystery$Changer.method(Mystery.java:11)
at test4.Mystery.main(Mystery.java:6)
...全文
13111打赏收藏
JAVA 报错 跪求改 分少见谅
package test4; public class Mystery { public static void main(String[] args ){ Changer c =new Changer(); c.method(args); System.out.println(args[0]+""+args[1]); } static class Changer{ void method(String[] s){ String temp=s[0]; s[0]=s[1]; s[1]=temp;