0 votes
in JAVA by
What does the expression float a = 35 / 0 return?

i) 0

ii) Not a Number

iii) Infinity

iv) Run time exception

1 Answer

0 votes
by

iii) Infinity

Reason: 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.

Related questions

0 votes
asked Apr 10, 2021 in JAVA by Robindeniel
0 votes
asked Apr 9, 2021 in JAVA by Robindeniel
...