
WhileDemo.java
public class WhileDemo {
public static void main(String[] args) {
System.out.println();
int i = 10; // 設定控制變數
while (i > 0) {
// 迴圈工作區
System.out.println(i);
i--; // 調整控制變數值
}
System.out.println();
}
}
/* 檔名: WhileDemo.java
作者: Kaiching Chang
時間: September, 2014 */ForDemo.java
public class ForDemo {
public static void main(String[] args) {
System.out.println();
for (int i = 10; i > 0; i--) {
System.out.println(i);
}
System.out.println();
}
}
/* 檔名: ForDemo.java
作者: Kaiching Chang
時間: September, 2014 */the end
沒有留言:
張貼留言