What does the expression float a = 35 / 0 return?
A. 0
B. Not a Number
C. Infinity
D. Run time exception
Answer:C
What does the expression float a = 35 / 0 return?
A. 0 B. Not a Number C. Infinity D. Run time exception
Explanation: In Java, whenever we divide any number (double, float, and long except integer) by zero, it results in infinity. According to the IEEE Standard for Floating-Point Arithmetic (IEEE 754), if we divide 1/0 will give positive infinity, -1/0 will give negative infinity, and 0/0 will give NaN. But on dividing an integer by zero, it throws a runtime exception, i.e., java.lang.ArithmeticException.