public class Reverse {
public static void main(String[] args) {
char name[]="prakash".toCharArray();////initialisng array
////////swapping string order//////////////
//////////i.e. reversing array of characters//////////
for(int i=0;i<=(name.length)/2;i++)
{
int j=name.length-i;
char temp;
temp=name[i];
name[i]=name[j];
name[j]=temp;
}
}
}
我收到以下错误:java.lang.ArrayIndexOutOfBoundsException
。代码有什么问题?