2

The behavior of Java is explained in this topic.

But, is Infinity useful for something?

Float:

public class DivisionByZeroFloat{
    public static void main(String[] args) {
        System.out.println(1.0 / 0);
    }
}

Console: Infinity

Integer

public class DivisionByZeroInteger {
    public static void main(String[] args) {
        System.out.println(1 / 0);
    }
}

Console: Exception in thread "main" java.lang.ArithmeticException: / by zero at DivisionByZeroInteger.main(DivisionByZeroInteger.java:4)

7