public class MathsHorrors { public static void main (String args[]) { // You'll need to comment out some lines to get to later ones // without exceptions. System.out.println("0.0/0.0 = " + 0.0/0.0); System.out.println("0/0 = " + 0/0); System.out.println("Double.isNaN(0.0/0.0) = " + Double.isNaN(0.0/0.0)); System.out.println("0.0/2.0 = " + 0.0/2.0); System.out.println("0/2 = " + 0/2); System.out.println("Double.isNaN(0.0/2.0) = " + Double.isNaN(0.0/2.0)); System.out.println("2.0/0.0 = " + 2.0/0.0); System.out.println("2/0 = " + 2/0); System.out.println("Double.isNaN(2.0/0.0) = " + Double.isNaN(2.0/0.0)); System.out.println("Double.isInfinite(2.0/0.0) = " + Double.isInfinite(2.0/0.0)); System.out.println("Double.isInfinite(0.0/0.0) = " + Double.isInfinite(0.0/0.0)); } }