day03--死循环
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
package com.inmind.circle06;
|
||||||
|
/*
|
||||||
|
死循环:循环条件永远满足
|
||||||
|
*/
|
||||||
|
public class Demo11 {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
//最重要最常用的死循环
|
||||||
|
int i = 1;
|
||||||
|
/*while (true) {
|
||||||
|
System.out.println(i++);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//for的死循环
|
||||||
|
/*for(;;){
|
||||||
|
System.out.println(i++);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//do-while死循环
|
||||||
|
do{
|
||||||
|
System.out.println(i++);
|
||||||
|
}while (true);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user