What will be the out put of the following code:
double k = 19; double m = 0;
k = k / m;
catch (Exception ex)
Different data type behave differently for divide by zero exception.
The above code does not throw devide by zero exception, but it will quitly execute and ‘k’ will have the value of ‘infinity’. So, don’t depend on a exception here. However, if ‘k’ and ‘m’ are int then you will get the divideByZero exception