Could the user have included digits 0, 1, ... 9 in the input characters?

A good answer might be:

Yes. They are characters just like any other.


Main Method

Later on we will do something special to convert strings of digits into primitive numeric types. This program does not do that. Here is the program again:

import java.io.*;
class Echo
{
  public static void main (String[] args) throws IOException
  {
    InputStreamReader inStream = 
        new InputStreamReader( System.in ) ;
    BufferedReader stdin =
        new BufferedReader( inStream );
 
    String inData;

    System.out.println("Enter the data:");
    inData = stdin.readLine();

    System.out.println("You entered:" + inData );
  }
}

The main method of class Echo starts with the line:

  public static void main (String[] args) throws IOException

You have seen most of this line before. This part: throws IOException is necessary for programs that do input (at least for now.) It informs the compiler that main() does an input operation that might fail. When the program is running and an input operation fails, the computer system will be informed of the failure and the program will be gracefully halted.

It would be extremely useful if you played with this program using the copy-paste-and-run method.

QUESTION 6:

Have you ever (on an old DOS or Windows system) had a program halt, but not halt gracefully?