OnJava8-Examples/control/WhileTest.java

17 lines
452 B
Java
Raw Normal View History

2015-04-20 15:36:01 -07:00
//: control/WhileTest.java
2015-05-29 14:18:51 -07:00
// <20>2015 MindView LLC: see Copyright.txt
2015-04-20 15:36:01 -07:00
// Demonstrates the while loop.
public class WhileTest {
static boolean condition() {
boolean result = Math.random() < 0.99;
System.out.print(result + ", ");
return result;
}
public static void main(String[] args) {
while(condition())
System.out.println("Inside 'while'");
System.out.println("Exited 'while'");
}
} /* (Execute to see output) *///:~