-5

How do I fix the illegal start of expression here, i don't see anything wrong with it though

static void divide(double a, double b){
            double c = (number_a / number_b);
            String s;
            if (c == Double.POSITIVE_INFINITY || c == Double.NEGATIVE_INFINITY || c == Double.NaN)
                s = "Undefined";
            else
                s = Double.toString(c);
            System.out.println(s);
        }
anthony
  • 3
  • 3

1 Answers1

0

Try this.

static void divide(double a, double b) {
    double c = a / b;
    String s;
    if (Double.isInfinite(c) || Double.isNaN(c))
        s = "Undefined";
    else
        s = Double.toString(c);
    System.out.println(s);
}