/*
* A:迴圈結構的分類
* for,while,do...while
* B:迴圈結構for語句的格式:
*
for(初始設定式;條件運算式;迴圈後的操作運算式) {
循環體;
}
* C執行流程:
* a:執行初始化語句
* b:執行判斷條件陳述式,看其返回值是true還是false
* 如果是true, 就繼續執行
* 如果是false, 就結束迴圈
* c:執行循環體語句;
* d:執行迴圈後的操作運算式
* e:回到B繼續。
* D:案例演示
* 在控制台輸出10次"helloworld"
*/
class Demo1_For {
public static void main(String[] args) {
//在控制輸出10次helloworld,這樣做不推薦,因為複用性太差
/*System.out.println("helloworld");
System.out.println("helloworld");
System.out.println("helloworld");
System.out.println("helloworld");
System.out.println("helloworld");
System.out.println("helloworld");
System.out.println("helloworld");
System.out.println("helloworld");
System.out.println("helloworld");
System.out.println("helloworld");*/
for (int i = 1;i <= 10 ;i++ ) {
System.out.println("helloworld");
}
}
}