Protect while loop controller variable : while « Statements « SCJP






public class MainClass {
  public static void main(String[] argv) {
    {
      int x = 0;
      while (x < 10) {
        System.out.println("value is " + x);
        x++;
      }
    }

  }
}
value is 0
value is 1
value is 2
value is 3
value is 4
value is 5
value is 6
value is 7
value is 8
value is 9








5.1.while
5.1.1.Using while Loops
5.1.2.A while loop might not ever run.
5.1.3.Protect while loop controller variable