Java를 오래 사용하지 못했습니다. 이 스크립트에서 Thread.sleep (10000); 당신은 여전히 입력 할 수 있습니다 (내가 이클립스 사용) 난 정말 당신이 내가 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.");