gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 22:11:27 27 4
gpt4 key购买 nike

我的代码示例:

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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com