No error when dividing by zero | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

No error when dividing by zero

Why is this code not giving any error when I'm dividing my zero? Am I not supposed to get Arithmetic exception? https://code.sololearn.com/cgLJ3oh1AcCQ/?ref=app

3rd Jan 2019, 5:18 PM
Asirap
1 Resposta
+ 5
For float and double types in Java there are special values like "Infinity". In case of int type it will throw an exception. You can read more here: https://www.geeksforgeeks.org/g-fact-33-infinity-or-exception/. I added on line 7 the result of that division, so you can see it. https://code.sololearn.com/cgIb3fOnN9ku/?ref=app
3rd Jan 2019, 5:55 PM
TheWhĀ”teCat šŸ‡§šŸ‡¬
TheWhĀ”teCat šŸ‡§šŸ‡¬ - avatar