// キーボードから入力された整数を画面に表示するプログラム import java.io.*; // おまじない class Sample5 { public static void main(String[] args) throws IOException { System.out.println("整数を入力して下さい。"); // 入力を要求 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // BufferedReaderクラスのインスタンス br を生成している String str = br.readLine(); // 入力された文字列をstrに読み込む int num = Integer.parseInt(str); // 文字列strを整数に変換してint型変数に格納 System.out.println(num + "が入力されました。"); /* str = br.readLine(); // 次に入力された文字列をstrに読み込む ・・・strを使った処理が続く */ } } // end of Sample5.java