我沒有做Java長。在這個腳本中它說Thread.sleep(10000);你仍然可以鍵入(我使用eclipse)我真的不知道爲什麼它可以讓你輸入輸出,當我沒有uno.nextLine();在10秒鐘之前或之後等待。請幫忙!由於簡單的Java掃描儀問題
import java.util.Scanner;
class Tutoiral{
public static void main (String args[])throws InterruptedException {
Scanner uno = new Scanner(System.in);
Scanner uno1 = new Scanner(System.in);
System.out.println("What's your name?");
String name = uno.nextLine();
System.out.println("Hi, " + name + ". Feel free to type whatever you want :) BUT DON'T SPAM!!!!!");
String typed = (": ") + uno1.nextLine();
System.out.println(name + typed + " (5 types remaining)");
uno.nextLine();
System.out.println(name + typed + " (4 types remaining)");
uno.nextLine();
System.out.println(name + typed + " (3 types remaining)");
uno.nextLine();
System.out.println(name + typed + " (2 types remaining)");
uno.nextLine();
System.out.println(name + typed + " (1 type remaining)");
uno.nextLine();
System.out.println(name + typed + " (If you type one more time, then I'll... I'll block you! Ha!)");
uno.nextLine();
System.out.println(name + typed + " (tut tut tut. You have been blocked for a while for spam. Don't type EVER again ok?)");
Thread.sleep(10000);
System.out.println("Ok, you can type again. But I wouldn't If I were you.");