输出应该是用自己的行向后打印的数组的每个单词
public class Main
{
public static void main(String[] args)
{
String [] list = {"every", "nearing", "checking", "food", "stand", "value"};
String reverse = "";
int length = list.length;
for(int j=0; j<list.length; j++)
{
String word = list[j];
for ( int i = length - 1 ; i >= 0 ; i-- )
{
reverse = reverse + word.charAt(i);
}
System.out.println(reverse);
}
}
}
但我不断收到这条消息
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String
index out of range: 5
at java.lang.String.charAt(String.java:658)
enter code here`at Main.main(Main.java:13)
哆啦的时光机
慕哥9229398
三国纷争
相关分类