Answers for "data-flair.training/blogs exception"

0

data-flair.training/blogs exception

try {
  //Code where exception can occur
}
catch(ExceptionTypeA e1) {
  //code that executes if Exception of type A occurs
}
catch(ExceptionTypeB e2) {
  //code that executes if Exception of type B occurs. 
}
Posted by: Guest on December-24-2020
0

data-flair.training/blogs exception

package com.dataflair.javaexceptions;
import java.io. * ;
public class CheckUnCheck {
  public static void main(String[] args) throws IOException {

    try {
      System.out.println(25 / 0);
      System.out.println("This statement will never get executed because the control has shifted to the catch block. ");
    }
    catch(Exception e) {
      System.out.println("You are trying to divide by zero! That is not right!");
    }
    finally {
      System.out.println("This code is in the finally block. It does not depend on whether an exception occurs or not. ");
    }
  }

}
Posted by: Guest on December-24-2020

Code answers related to "data-flair.training/blogs exception"

Browse Popular Code Answers by Language