+ 1

Help I'm stuck on practice lesson 57.2 No Zero's

Please help I keep getting and Error on ArithmeticException and I have spent a day trying to figure out what is wrong with the code... I dug threw the comments and someone mentioned something about it getting messed up being translated but no one showed what to do to fix it .....I'm so close to finishing but I am out of ideas on how to fix this problem any help is greatly appreciated 🙏 happy Codding 😊 import java.util.Scanner; import java.util.InputMismatchException; public class Main { public static void Main(String[] args) { Scanner scanner = new Scanner(System.in); try { int num1 = scanner.nextInt(); int num2 = scanner.nextInt(); System.out.println(num1/num2); } catch(ArithmaticException ex){ System.out.println("Error: division by zero"); } catch(InputMismatchException ex){ System.out.println("Error: wrong value type"); } } }

30th Oct 2022, 5:04 PM
jessica bencivenga
jessica bencivenga - avatar
3 odpowiedzi
+ 7
main( .. Should be small m. You are using Capital M. Spelling mistake in ArithmeticException
30th Oct 2022, 5:18 PM
Jayakrishna 🇮🇳
+ 1
Thank you so much I was going crazy lol
30th Oct 2022, 7:19 PM
jessica bencivenga
jessica bencivenga - avatar
0
One } parenthesis extra and also remove the capital Main this should be written main
30th Oct 2022, 6:08 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar