输入输出
从键盘输入
Scanner in = new Scanner(System.in);
int x = in.nextInt();
String y = in.next();
System.out.printf("x = %d, y = %s\n", x, y);
从文本输入
try {
in = new Scanner(new FileInputStream("Learn/in.txt"));
while(in.hasNext()) {
x = in.nextInt();
System.out.println(x);
}
in.close();
} catch(FileNotFoundException e) {
System.out.println(e);
}