所以我正在创建一个基于文本的游戏,我很难找到一种在文本显示之间暂停的方法。我知道线程睡眠会起作用,但我不想这样做数百行文本。这就是我所拥有的,但是有没有更简单的方法可以做到这一点?
public class MyClass {
public static void main(String[] args) {
System.out.println("Hello?");
//pause here
System.out.println("Is this thing on?");
/**Obviously I have a pause here, but I dont want to have to use this every time.*/
try {
Thread.sleep(x);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Now, what is your name?");
}
}