[5005] in java-interest
ArithmeticException problem?
daemon@ATHENA.MIT.EDU (Roberto Flores-Mendez)
Thu Jan 25 18:57:27 1996
To: java-interest@java.sun.com
Date: Thu, 25 Jan 1996 15:15:23 -0700
From: Roberto Flores-Mendez <robertof@cpsc.ucalgary.ca>
Hi, there
I was trying an application with some mathematic operations that would trigger
a division by zero. I tried to use an ArithmeticException to catch this, but
it does not seem to work. Does anybody has a clue about this?
I've include a small example of what I have in my code and the output
generated.
(I'm using Windows 95 and JDK beta 2)
Thanks in advance, Roberto.
class DivideByZero {
public static void main(String args[]) {
float average = 0;
try {
float sum = 123;
float zero = 0;
System.out.println("Here I go!!");
average = sum / zero;
System.out.println("This should not be printed..");
}
catch (ArithmeticException e) {
System.out.println("Exception caught!!");
}
finally {
System.out.println("Going out!!");
}
}
}
The output generated is:
Here I go!!"
This should not be printed..
Going out!!
--
Roberto A. Flores-Mendez (robertof@cpsc.ucalgary.ca)
WWW http://www.cpsc.ucalgary.ca/~robertof/
Phone +1 (403) 220-7140
Fax +1 (403) 288-0358
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com