upublic class MyRatio
extends Object {
u public MyRatio() {
int numerator = 5;
u int denominator = 0;
u int ratio;
u try { //The beginning of a try block
u ratio = numerator / denominator ;
//divide by zero
u }
u catch (Exception e) { //the start of the
catch block
u e.printStackTrace(); //sends error msg
to screen
u }
u System.out.println("Printed because
the error is
handled
correctly");
u }
u public static void main(String[] args) {
//This is the main
method
u new MyRatio(); //This calls the
constructor
}
u }