Andy ¢(317725224) import java.io.*;public class ReadCharTest { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int a[] = new int[10];
System.out.println("请输入10个数"); int i;
for (int j; j >= 0; j--) {
int j = i.length - 1;

System.out.println(a[j]);
}
System.out.println("请输出10个数");
System.out.println(br.readLine());
}}
怎么输入10个数字,逆序输出呢?  BufferedReader readLine()

解决方案 »

  1.   

    用split方法把输入的String分成10个,在把每个数字从String转化为int啊,用Integer.parseInt(String s)
      

  2.   

    import java.io.*;public class ReadCharTest { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    byte[] a = new byte[10];
    System.out.println("请输入10个数");
    try {
    System.in.read(a);
    String str = new String(a);
    for (int j = str.length() - 1; j >= 0; j--) {
    System.out.println(str.charAt(j));
    }
    System.out.println(str.trim());
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    }
    我这样写,比如:输入1234567891 才可以逆序,1 2 3 4 5 6 7 8 9 10 就会出问题,怎么办?