// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class DivZero {

    public static void main(String[] args) {
        try {
            int v1 = 1;
            int v2 = 0;
            int v3 = v1 / v2;
            System.out.println("Result: " + v3);
        } catch (ArithmeticException ex) {
            System.out.println("Exception: " + ex.getMessage());
        }
        try {
            double v1 = 1.0;
            double v2 = 0.0;
            double v3 = v1 / v2;
            System.out.println("Result: " + v3);
        } catch (ArithmeticException ex) {
            System.out.println("Exception: " + ex.getMessage());
        }
    }
}
