You are viewing a single comment's thread. Return to all comments →
import java.util.*; public class Myexception { public static void main(String args[]) { try { Scanner sc = new Scanner(System.in); System.out.println(sc.nextInt()/ sc.nextInt()); } catch (Exception e){ if(e.toString().length()>40) System.out.println("java.util.InputMismatchException"); else System.out.println(e); } } }
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 →