[Java] 逐字打印


1. 主要功能

  • 逐字打印;
  • 跳过空格;

2. Java 实现

public class Test {
    public static void main(String[] args) throws InterruptedException {
        String s = "Hello, I am Regino!";
        for (int i = 0; i < s.length(); i++) {
            System.out.print(s.charAt(i));
            if (s.charAt(i) != ' ') {
                Thread.sleep(500);
            }
        }
    }
}
发布了185 篇原创文章 · 获赞 181 · 访问量 5355

猜你喜欢

转载自blog.csdn.net/Regino/article/details/104695859