■ A while loop can appear all on one line. i.e.
while ( i < x
&& a = b ) i++; works.
■ Infinite loops. This code creates an infinite loop: while (true) { }
If
you use it, you typically break out of the loop by catching some
exception. i.e. catching an EOF
exception while reading a file
import java.io.*;
try {
DataInputStream dis = new
DataInputStream( new BufferedInputStream( new FileInputStream(
"input.file")));
while(true) System.out.print( (char)
dis.readByte( ) );
}
catch (EOFException eof)
{ System.out.println(eof); }
catch (IOException io) { }