The "expression" in the while() loop condition is gets evaluated and which must be resulted in either "true" value or "false" value. 'true' is the Java boolean literal, and after evaluating this literal produces the same value, i.e 'true'. Hence it works..
while condition should always evaluate to a boolean value. So the end result that while has always is either true or false and not x>2 or x==5. Also in java we cannot check x = 0 like in C or C++ in a while of if. Its always a boolean value. So if you directly right a boolean value or indirectly by giving an expression its one and the same to get a boolean value.
[ SCJP 6.0 - 90% ] , JSP, Servlets and Learning EJB.
Try out the programs using a TextEditor. Textpad - Java 6 api
In C the concept of booleans is by numerics 0 or other; 0 meaning false. Everytime a variable is intialized, it returns that value.
int x = 1; returns 1 where we don't care about it during normal intialization.
Let's get back to java. JVM has only numeric datatypes, but the compiler knows of booleans too; hence booleans are strictly required where a condition is to be evaluated.