Demonstrates the while loop. : While « Language Basics « Java






Demonstrates the while loop.

Demonstrates the while loop.
//: c03:WhileTest.java
// 
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.

public class WhileTest {
  public static void main(String[] args) {
    double r = 0;
    while(r < 0.99d) {
      r = Math.random();
      System.out.println(r);
    }
  }
} ///:~



           
       








Related examples in the same category

1.while Demowhile Demo
2.Do While DemoDo While Demo
3.Do WhileDo While
4.Java labeled while loop.Java labeled while loop.
5.uses a do-while loop to get this input from the user