package qiye;
import java.io.BufferedReader;
import java.io.Console;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class shuru {
public static void main(String args[]) throws IllegalStateException {
/*方法一:使用Scanner类
* 这些方法在执行时都会阻塞,程序等待用户在输入流中输入enter键(\n)时继续执行。
* 这里的nextInt,hasNextInt()这些方法的调用,会判断当前字节流里面是否有东西,
* 没有就阻塞等待输入直到用户按enter键(\n)结束输入,在Scanner类中有一个变量needInput,
* 当需要读取数据时,needInput=true(也就是调用nextInt,hasNextInt()这些函数的时候)。
* 有一个readInput方法,当字节流中有东西可读时,让needInput=false(表示不需要阻塞等待输入);*/
Scanner sc=new Scanner(System.in);
// String s=sc.next();//输入字符串,以空格作为分隔符 如果输入I am a boy 只能读取到I
// String s1=sc.nextLine();//输入字符串,以Enter键结束。如果输入I am a boy Enter键会读取到I am a boy
int a,b;
a=sc.nextInt();
System.out.println(a);
b=sc.nextInt();
System.out.println(b);
//方法二:使用java.io.BufferedReader和java.io.InputStreamReader
/* BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str=null;
while(true) {
str=br.readLine();
if(str.equals("End")) {
break;
}
System.out.print(str);
}
*/
//方法三:使用java.io.Console 方法三报错?
// Console console = System.console();
// if (console == null) {
// throw new IllegalStateException("Console is not available!");
// }
// String str =null;
// while(true){
// str = console.readLine("请输入");
// if("END".equals(str))break;
// System.out.println(str);
// }
}
}