Dowemo
0 0 0 0

public class Control {
 public static void main(String[] args) {
///<JAVA控制流:包含 while/do while/for 三个循环结构及 if/switch 两种选择结构 
///<1.while语法格式
///while( 布尔表达式 ) {
///
///}
 int i = 0;
 int sum = 0;
 while (i <= 100) {
 sum += i;
 i++;
 } 
///<2.do while语法格式
///do {
///
///} while ();
 int i1 = 0;
 int sum1 = 0;
 do {
 sum1 += i1;
 i1++;
 } while (i1<= 10);
///<3.for语法格式
///<for (初始化;布尔表达式;循环控制变量) {
///
///}
 int sum2 = 0;
 for (int i2 = 0; i2 <= 10; i2++) {
 sum2 += i2;
 System.out.println(sum2);
 }
///<4.if语法格式
///<if (布尔表达式) {
///
///}
 int sum3 = 0;
 if (sum3> = 0) {
 sum3 += 10;
 }
/*
///<5.if语法格式
 swift (expression) {
 case value :
 语句
 break;
 case value :
 语句
 break;
 defallt;
 }*/
 int sum4 = 0;
 for (int i4 = 0; i4 <10; i4 ++) {
 int result = i4 % 2;
 switch (result) {
 case 0:
 sum4 +=i4;
 break;
 case 1:
 break;
 }
 }
 } 
}





Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs