Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Exceptions handling in Java in Java

  1. import java.io.*;
  2.  
  3. public class exceptionHandle{
  4. public static void main(String[] args) throws Exception{
  5. try{
  6. int a,b;
  7. BufferedReader in =
  8. new BufferedReader(new InputStreamReader(System.in));
  9. a = Integer.parseInt(in.readLine());
  10. b = Integer.parseInt(in.readLine());
  11. }
  12. catch(NumberFormatException ex){
  13. System.out.println(ex.getMessage()
  14. + " is not a numeric value.");
  15. System.exit(0);
  16. }
  17. }
  18. }