【发布时间】:2013-12-06 17:20:55
【问题描述】:
import java.util.Scanner;
public class ReverseOrder
{
char input;
public static void main (String[] args)
{
Scanner reader = new Scanner (System.in);
char [] ch = new char[5];
System.out.println ("The size of the array: " + ch.length);
for (char index = 0; index < ch.length; index++)
{
System.out.print ("Enter a char " + (index+1) + ": ");
ch[index] = reader.next().charAt(0);
}
System.out.println ("The numbers in reverse order:");
for (char index = (char) (ch.length-1); index >= 0; index--)
System.out.print (ch[index] + " ");
}
}
【问题讨论】:
-
什么异常,堆栈跟踪告诉你什么行号?不要让我们猜测!
-
我是 Java 新手。我不知道在这里做什么。如果不嫌麻烦的话,能不能复制粘贴到eclipse里?
-
Collections.reverse(Arrays.asList(array));
-
编写一个程序,将 5 个单个字符而不是数字作为输入并以相反的顺序输出它们
-
这是我在线程 "main" java.lang.ArrayIndexOutOfBoundsException: 65535 at ReverseOrder.main(ReverseOrder.java:39) 中得到异常的错误
标签: java multithreading exception main