接口调用不成功,最多还能调用两次
这种需求,我们在实际项目开发中,这种情况是比较多见的。
下面是伪代码:
package com.zyq; public class Test01 { public static void main(String[] args) { // int count = 0; while (count < 2) { boolean flag=false;//调用接口的返回结果 if(flag){ System.out.println("调用成功"); break; }else{ System.out.println("没有调用成功"); count++; } } System.out.println("========"); } }