A good answer might be:


Example IO Program

The following program reads characters from the keyboard into the String called inData. Then the characters stored in that String are sent to the monitor. The details of this program are explained in the next several pages.

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 line  import java.io.*;  says that the package java.io will be used. The  *  means that any class inside the package might be used. Here is how this program runs:

C:\users\default>java Echo

Enter the data:
This is what the user enters
You entered:This is what the user enters

C:\users\default>

QUESTION 5:

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