You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.;
public class Solution {
public static void main(String[] args) { Scanner scan= new Scanner (System.in); try { int a=scan.nextInt(); int b=scan.nextInt(); int c=a/b; System.out.println(c); }catch(InputMismatchException ie){ System.out.println("java.util.InputMismatchException"); }catch(ArithmeticException ae){ System.out.println("java.lang.ArithmeticException: / by zero"); } }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Java Exception Handling (Try-catch)
You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.;
public class Solution {
}