public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String lastStr  = "" ;
while(true){
lastStr = input.next();   // (1) 
System.out.println("输入内容:" + lastStr); // (2)
}
}
当用户 在 (1) 代码处  5 秒之内都没有输入 , 就自动跳过代码 (1) 执行代码 (2) ,然后继续循环。