Previous


Platform-Specific Details: The End-of-Input Character

UNIX
Use the control-D character (type D while holding down the control key) to indicate to a program reading from the standard input stream that you have finished entering input. The control-D character is often written as ^D.
% java Count
This is a test.
^D
Input has 16 chars.
DOS shell (Windows 95/NT)
Use the control-Z character (type Z while holding down the control key) to indicate to a program reading from the standard input stream that you have finished entering input. Or you can press the F6 key. The control-Z character is often written as ^Z.
C:\> java Count
This is a test.
^Z
Input has 17 chars.
Note: the program gives different results for UNIX and DOS systems. On UNIX when you press the return key, you get a single character \n. However, on DOS when you press the return key, you get two characters \r\n.


Previous