while 循环
1while(condition){ 2 //xxx 3}

for循环
1for(initialization;expression;update){//注意是分号的 2 //xxxx 3} 4 5 6 for(int x = 10; x < 20; x = x + 1) { 7 System.out.print("value of x : " + x ); 8 System.out.print("\n"); 9 }

1do{ 2 //xxxx 3}while(condition); 4 5int x = 10; 6 do { 7 System.out.print("value of x : " + x ); 8 x++; 9 System.out.print("\n"); 10 }while( x < 20 ); 11 12

循环控制声明 break 
1int [] numbers = {10, 20, 30, 40, 50}; 2 3 for(int x : numbers ) { 4 if( x == 30 ) { 5 break; 6 } 7 System.out.print( x ); 8 System.out.print("\n"); 9 }
continue 
1int [] numbers = {10, 20, 30, 40, 50}; 2 3 for(int x : numbers ) { 4 if( x == 30 ) { 5 continue; 6 } 7 System.out.print( x ); 8 System.out.print("\n"); 9 }
java 循环增强
1for(declaration : expression) { 2 // Statements 3} 4 5public class Test { 6 7 public static void main(String args[]) { 8 int [] numbers = {10, 20, 30, 40, 50}; 9 10 for(int x : numbers ) { 11 System.out.print( x ); 12 System.out.print(","); 13 } 14 System.out.print("\n"); 15 String [] names = {"James", "Larry", "Tom", "Lacy"}; //大括号 16 17 for( String name : names ) { 18 System.out.print( name ); 19 System.out.print(","); 20 } 21 } 22}
