教育サーバーのページ
オンラインテキスト目次
ソフトウエア入門演習
import java.io.*; public class InputTwoLines { public static void main(String[] args) throws IOException { String s1, s2; BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); s1 = buf.readLine(); s2 = buf.readLine(); System.out.println(s1); System.out.println(s2); } }
import java.io.*; public class InputTwoLines { public static void main(String[] args) throws IOException { String s; int a, b; BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); s = buf.readLine(); a = Integer.parseInt(s); s = buf.readLine(); b = Integer.parseInt(s); System.out.println(a + b); } }