2010-10-04 36 views

回答

4

下面是一个例子:

int i = 0; 
do{ 
    if(i == 5) 
     // Won't print 5 but instead go back to the "top" of do 
     // but first, will execute the while verification 
     continue; 
    System.out.println(i); 
}while(i++ < 10); 

Example on ideone

+0

+1是一个简短的例子 – Ishtar 2010-10-04 11:09:26

3

A continue声明转到下一次迭代的开始。你不能在相同的迭代中回去。见the docs