自己写的一段重试代码

来源:互联网 发布:java 邀请码 编辑:程序博客网 时间:2024/06/10 08:42
public class TestRetry {public static void main(String[] args) {retry(5);}private static void retry(int maxCount) {int count = 0;boolean result = false;do {count++;System.out.println("count="+count);/*if(count==2) {result = true;}*/} while (count<maxCount && result == false);}}

0 0