You are viewing a single comment's thread. Return to all comments →
Scanner in = new Scanner(System.in);
try{ int x = in.nextInt(); int y = in.nextInt(); if(x>=0 && y>=0) System.out.println(x/y); }catch(InputMismatchException ee){ System.out.println("java.util.InputMismatchException"); } catch(Exception e){ System.out.println(e.toString()); } }
}
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 →
Scanner in = new Scanner(System.in);
}