一个很简单的do-while

不多说了,就当复习一下基础吧,谢谢!

public class Dowhile {
public static void main(String[] args) {

int a = 1;
do {
System.out.println("a="+a);
a++;
if (a==10) {
System.out.println("我是第10个,跳出循环了");
/*continue;
break;
return;*/
break;
}
} while (a<=20);
}
}

posted @ 2017-11-25 20:45  萌的一波  阅读(144)  评论(0编辑  收藏  举报