System does not throw a exception when I divide a Area by zero | Core Java Forum
Vikrant Feddewar 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

Yogesh Chawla Replied on 18/07/2021


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.

Vikrant Feddewar Replied on 19/07/2021

ok Thanks, I got it.