Why does dividing an int by zero crash your Java program, but dividing a float by zero doesn’t?
In this video, we explore this surprising difference and uncover what’s really happening under the hood. You’ll see how Java handles arithmetic operations differently for integers and floating-point numbers.
We’ll cover:
Why int / 0 throws an ArithmeticException
Why float / 0 results in Infinity instead
How IEEE 754 floating-point rules influence Java’s behavior
On this page of the site you can watch the video online Understanding Division by Zero in Java | Int vs Float in Java | Less Known Java Principles | Ep 08 with a duration of hours minute second in good quality, which was uploaded by the user Banerjee Codes 10 May 2026, share the link with friends and acquaintances, this video has already been watched 2 times on youtube and it was liked by 0 viewers. Enjoy your viewing!