import java.io.*; public class r3Sample2 { /** * @param args the command line arguments */ public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.println("入力した数値を逆順に表示するプログラムです。"); int[] a = new int [100]; int count = 0; while (count < a.length){ System.out.print("" + count + "> "); int v = (new Integer(in.readLine())).intValue(); if (v == 0) { break;} a[count] = v; ++count; } for (int i = count-1; i >= 0; --i) { System.out.println(a[i]); } } }