day03-死循环
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
package com.inmind.break06;
|
||||||
|
/*
|
||||||
|
死循环:循环条件永远满足true
|
||||||
|
如何结束死循环:break
|
||||||
|
*/
|
||||||
|
public class Demo12 {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
//最常见的死循环
|
||||||
|
/*while (true) {
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//for的死循环
|
||||||
|
/*for(;;){
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//do-while的死循环
|
||||||
|
do{
|
||||||
|
System.out.println(3);
|
||||||
|
}while(true);
|
||||||
|
|
||||||
|
// System.out.println("程序结束");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user