关于java中的循环语句

[复制链接]
查看11 | 回复0 | 2007-11-3 12:52:24 | 显示全部楼层 |阅读模式
public class BreakLoop3 { public static void main(String args[]) {for(int i=0; i<3; i++) {
System.out.print("Pass " + i + ": ");
for(int j=0; j<100; j++)
{
if(j == 10) break; // terminate loop if j is 10
System.out.print(j + " ");
}
System.out.println(); }
System.out.println("Loops complete.");} }Pass 0: 0 1 2 3 4 5 6 7 8 9 Pass 1: 0 1 2 3 4 5 6 7 8 9 Pass 2: 0 1 2 3 4 5 6 7 8 9 Loops complete.System.out.println()是换行的意思,写代码要形成格式化的好习惯,维护起来也好方便的.
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行