我的程序是这样的
public class Test {
public static void main(String[] args){
char newoperright[]= new char[15];
for (int i=0; i< 15; i++)
newoperright[i]= '0';
String str="1234";
char temp[]=str.toCharArray();
for(int i=0;i<temp.length;i++){
int moduleid= temp[i];
newoperright[moduleid-1]= '1';
}
System.out.println(newoperright);
}
}程序运行的时候提示ArrayIndexOutOfBoundsException,是怎么了呢?,先谢谢大家了
public class Test {
public static void main(String[] args){
char newoperright[]= new char[15];
for (int i=0; i< 15; i++)
newoperright[i]= '0';
String str="1234";
char temp[]=str.toCharArray();
for(int i=0;i<temp.length;i++){
int moduleid= temp[i];
newoperright[moduleid-1]= '1';
}
System.out.println(newoperright);
}
}程序运行的时候提示ArrayIndexOutOfBoundsException,是怎么了呢?,先谢谢大家了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货