import java.io.*; import java.util.*; public class Test { public static void main(String args[]) { Scanner sc = new Scanner(System.in); while (sc.hasNextInt()) { int x = sc.nextInt(); System.out.printf("入力データ: %d\n", x); } } }
c:\tmp>java Test 1 2 3 入力データ: 1 入力データ: 2 入力データ: 3 4 入力データ: 4 5 入力データ: 5 ^D