怎么跳出for循环

[复制链接]
查看11 | 回复3 | 2012-9-12 22:38:02 | 显示全部楼层 |阅读模式
你每次进循环都重新给count赋值为1,所以每次判断count最大只能是2把int count=1;放循环前面去...
回复

使用道具 举报

千问 | 2012-9-12 22:38:02 | 显示全部楼层
package grandchildren; public class Grandchildren { public static void main(String args[]){ int n; int count=1; for(n=1;n<=9999;n++) {
if((n%3==2)...
回复

使用道具 举报

千问 | 2012-9-12 22:38:02 | 显示全部楼层
break应该就能跳出啊...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行