+ 2

I'm getting error where my output and expected output is same.

I'm into Multiple exception handling now I'm receiving error and i can't move to next stag my code and output is same as solution and expected output.

31st Jul 2022, 1:10 PM
Muruganantham C
Muruganantham C - avatar
9 Réponses
+ 2
Rewrite the phrase : "Error: division by zero" Then try...
31st Jul 2022, 1:35 PM
Jayakrishna 🇮🇳
+ 2
Not enough details... In which language? Pls show your code.. Along with trouble..
31st Jul 2022, 1:22 PM
Jayakrishna 🇮🇳
+ 2
Code is working fine.. Do you testing this in code coach?
31st Jul 2022, 1:29 PM
Jayakrishna 🇮🇳
+ 2
I actually copy pasted the exact phrase from the problem https://prnt.sc/JcXFgt-C9rSf
31st Jul 2022, 1:44 PM
Muruganantham C
Muruganantham C - avatar
+ 2
This q/a (discuss) is here for that purpose only.. Try to make best use of it if needed.. You're welcome...
31st Jul 2022, 2:03 PM
Jayakrishna 🇮🇳
+ 1
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); /* 1. Error: division by zero 2. Error: wrong value type */ //your code goes here } catch(ArithmeticException e1) { System.out.println("Еrror: division by zero"); } catch(InputMismatchException e2){ System.out.println("Error: wrong value type"); } } }
31st Jul 2022, 1:23 PM
Muruganantham C
Muruganantham C - avatar
+ 1
Actually my problem is my code is wright but i can't move to next stage i felt like bug My output and expected output both are same but showing error. How to resolve this issue?
31st Jul 2022, 1:31 PM
Muruganantham C
Muruganantham C - avatar
+ 1
That's what the problem. Problem description has a invisible character in the phrase. So won't matching with expected output... just rewrite your own.. then try.. or copy from code comments..
31st Jul 2022, 1:55 PM
Jayakrishna 🇮🇳
+ 1
Thanq bro.. I'm new here, i didn't aware of this..
31st Jul 2022, 2:00 PM
Muruganantham C
Muruganantham C - avatar