Merge pull request #4279 from psysane/master

[BAEL-1796] Infinite loop using Java
This commit is contained in:
Tom Hombergs 2018-05-21 09:52:04 +02:00 committed by GitHub
commit 7bba73c6eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
package com.baeldung.loops;
public class InfiniteLoops {
public void infiniteLoopUsingWhile() {
while (true) {
System.out.println("Infinite loop using while");
}
}
public void infiniteLoopUsingFor() {
for (;;) {
System.out.println("Infinite loop using for");
}
}
public void infiniteLoopUsingDoWhile() {
do {
System.out.println("Infinite loop using do-while");
} while (true);
}
}