System does not throw a exception when I divide a Area by zero | Core Java Forum
V
Vikrant Posted on 18/07/2021

Hi Yogesh,

I am trying to divide the area by 0 but its not giving me any exception, its simply printing the infinity.

Please look the below code and let me why its not giving me any exception


Y
Yogesh Chawla Replied on 18/07/2021

Hi,

Ariithmetic Exception comes when a integer is divided by 0(byte, short, int,long - anyone of these four). This statement is not valid for float or double. With them, infinity only comes as any output.


V
Vikrant Replied on 19/07/2021

ok Thanks, I got it.