java - 如何延迟程序以便在文本之间有停顿?

标签 java text delay

我的代码示例:

System.out.println("Why hello there!");
System.out.println("Welcome to 'Ancient Battles and Adventures!");
***DELAY WOULD GO HERE***
System.out.println("Now, what is your name?");

最佳答案

public class MyClass {
    public static void main(String[] args) {
        System.out.println("Why hello there!");
        System.out.println("Welcome to 'Ancient Battles and Adventures!");
        try {
            Thread.sleep(x);
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("Now, what is your name?");
    }
}

关于java - 如何延迟程序以便在文本之间有停顿?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31738259/

相关文章:

Java - PaintComponent 中的 MouseListener 操作事件

Java apache fop 2.2 某些西里尔字符的错误呈现

java - 使用不带数组的扫描仪从文本文件中删除重复数据 (Java)

Java Hashtable containsValue() 不起作用

javascript - 执行jquery延迟和队列:false negate each other?

wpf - 如何在WPF密码框中显示几秒钟的字符?

java - 计算运行Java程序的两台计算机之间的消息延迟

java - 警告 Xamarin android - 未提供 -tsa 或 -tsacert 并且此 jar 没有时间戳

java - 删除 MouseListener 会产生 ArrayIndexOutOfBoundsException

shell - 如何使用 shell 脚本删除文本文件中以数字开头的行