Files
javaSE-0113/day03/src/com/inmind/circle_control07/Demo14.java

28 lines
708 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.inmind.circle_control07;
/*
死循环:循环条件永远满足
*/
public class Demo14 {
public static void main(String[] args) {
//while 死循环 :最常用的死循环
while (true) {
System.out.println(1);
//在死循环中可以使用break在满足某种条件下结束循环
}
//---------------------------------------
//for 死循环
/*for (; ; ) {
System.out.println(1);
}
*/
//---------------------------
//do-while 死循环
/*do {
System.out.println(1);
} while (true);*/
// System.out.println("程序结束");
}
}