forked from ChrisMayfield/ThinkJavaCode2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInfinite.java
More file actions
20 lines (16 loc) · 415 Bytes
/
Infinite.java
File metadata and controls
20 lines (16 loc) · 415 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
* Infinite loop example.
*/
public class Infinite {
public static void main(String[] args) {
int x = 1;
int y = -1;
while (x > 0 && y < 0) {
// do something to x
// do something to y
System.out.println("x: " + x);
System.out.println("y: " + y);
System.out.println("condition: " + (x > 0 && y < 0));
}
}
}