java控制台输出百分比进度条示例
时间:2023-08-21 22:58:20
System.out.print("\b") 会在控制台下往回删掉一个字符,如果你想回删多个字符就打印多个 "\b"
public static void main(String[] args) throws Exception {
System.out.print("Progress:");
for (int i = 1; i <= 100; i++) {
System.out.print(i + "%");
Thread.sleep(100);
for (int j = 0; j <= String.valueOf(i).length(); j++) {
System.out.print("\b");
}
}
System.out.println();
}
标签:java,控制台,进度条
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
c# 调用Win32Api关闭当前应用的方法
2023-09-22 20:51:26
C#使用Process类调用外部exe程序
2023-02-12 16:54:20
js事件模型与自定义事件实例解析
2021-05-26 06:15:06
c#二维码生成的代码分享
2022-11-28 15:19:37
JAVA多线程知识汇总
2021-08-03 09:04:47
解析Java设计模式编程中命令模式的使用
2023-11-12 04:49:45
![](https://img.aspxhome.com/file/2023/3/59513_0s.jpg)
C#观察者模式(Observer Pattern)实例教程
2021-07-13 02:53:39
SpringBoot接口如何对参数进行校验
2021-08-30 17:25:00
![](https://img.aspxhome.com/file/2023/5/74895_0s.png)
Java自定义异常类的实例详解
2021-10-21 07:18:33
Flutter 剪裁组件的使用
2023-06-18 13:15:04
![](https://img.aspxhome.com/file/2023/3/96783_0s.png)
Android实现屏幕锁定源码详解
2022-10-08 00:46:38
![](https://img.aspxhome.com/file/2023/1/123251_0s.png)
通过Java实现bash命令过程解析
2023-01-07 17:38:25
解决idea打包成功但是resource下的文件没有成功的问题
2023-10-11 06:21:12
![](https://img.aspxhome.com/file/2023/3/119173_0s.jpg)
java注解的全面分析
2023-11-25 11:28:50
MyBatisPlus代码生成器的使用示例
2022-04-28 07:52:42
![](https://img.aspxhome.com/file/2023/7/125657_0s.png)
在C#中使用MSMQ的方法
2023-04-05 20:28:29
java判断String类型是否能转换为int的方法
2022-08-17 23:45:52
Java的split方法使用详解
2021-10-03 06:09:57
![](https://img.aspxhome.com/file/2023/3/64523_0s.png)
Spring注解@Configuration与@Bean注册组件的使用详解
2022-09-13 01:52:56
![](https://img.aspxhome.com/file/2023/2/64532_0s.png)
Idea中SpringBoot多模块项目的建立实现
2023-11-08 07:52:34
![](https://img.aspxhome.com/file/2023/3/58743_0s.png)