Creation should replicate the structure of the following example:
import java.io.*;
public class MakeSomeErrors {
//a method to read in keystrokes from the command (as a String) and
//convert the keystrokes to integers.
static int getNumber ( ) throws IOException
{ BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter an integer: ");
String s = input.readLine();
return Integer.parseInt(s);
}
//a main method to begin execution
public static void main(String args[]) {
int numOne = 0, numTwo = 1, numThree = 0;
//the getNumber() method call must be enclosed in a try block because it is
//defined with a throws clause
try{
numOne = getNumber();
numTwo = getNumber();
numThree = numOne / numTwo;
}
//a catch statement that will receive the IO Exception and print the problem
catch (Exception e) {
System.out.println("[" + e + "]");
}
System.out.println( numOne + "/" + numTwo + " = " + numThree);
}
}