Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Exception {
- public static void main(String[] args) {
- try{
- int d=0, n=20; //fraction =n/d;
- }catch(ArithmeticException e){
- System.out.println("In the catch clock due to Exception=" +e);
- }finally{
- System.out.println("Inside the finally block.");
- }
- }}
- int d=0, n=20;
- if(n/d){
- throw new ArithmeticException("Number divided by zero");
- }else{
- System.out.println("ABC");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement