|
public class SystemTest
{
public static void main (String args []) throws Exception
{
int count = 0;
System.out.println ("Enter characters, 'q' to quit.");
while ('q'! = (char) (count = System.in.read ()))
{
System.out.print ((char) count);
}
}
}
This program outputs the characters entered by the keyboard to the screen. The program terminates when it encounters the letter q
But after running in eclipse, you can display the output in the console, but why not stop when you press q? |
|