while (boolean-expression)
boolean
type holds either one of these values
true
and false
are reserved words in java.
i < 4
is a boolean expression
while ( i = 3)
is a syntax error.
String word; while ( word < "exit") {
double value = 983, error; error = Math.abs(value - 0.01); while (error > 0.01) { value = value / 10; error = Math.abs(value - 0.01); System.out.printf("%.5f %.3E\n", value, error); }
98.30000 9.829E+01 9.83000 9.820E+00 0.98300 9.730E-01 0.09830 8.830E-02 0.00983 1.700E-04