/*--------------------------------------------------
Import the BufferedReader and InputStreamReader
classes.
--------------------------------------------------*/
import java.io.*;
class ConsolePauseDemo
{
/*--------------------------------------------------
Methods using IO classes must throw or
catch the IOException class. Exceptions are
covered in POS 407 and for now are a form
of error handling in Java and these classes
have to handle issues like the input source
such as a keyboard or hard drive not being
avaiable.
--------------------------------------------------*/
public static void main (String[] args) throws IOException
{
/*--------------------------------------------------
new InputStreamReader(System.in)
Create an "anonymous" InputStreamReader object
variable using the standard input stream
referenced by the System.in object.
BufferedReader in = new BufferedReader(
Create a BufferedReader object
variable named "myIn". This allows the computer
to process characters in batches instead of
one character at a time.
--------------------------------------------------*/
BufferedReader myIn =
new BufferedReader(new InputStreamReader(System.in));
/*--------------------------------------------------
Message to console
--------------------------------------------------*/
System.out.println("Press enter to continue...");
/*--------------------------------------------------
Use the BufferedReader myIn object variable
readLine method to get characters.
--------------------------------------------------*/
myIn.readLine();
/*--------------------------------------------------
Message to console
--------------------------------------------------*/
System.out.println("Good bye!");
}
}