Answers for "exception handling in java code"

2

exception handling in java

public class JavaExceptionExample{  
  public static void main(String args[]){  
   try{  
      //code that may raise exception  
      int data=100/0;  
   }catch(ArithmeticException e){System.out.println(e);}  
   //rest code of the program   
   System.out.println("rest of the code...");  
  }  
}
Posted by: Guest on February-07-2022
0

exception class implementation in java

public class JavaExceptionExample extends Exception{  
  public JavaExceptionExample(){
  }
   public JavaExceptionExample(String s){
     //String parameter which is the detail message of the exception.
  }
}
Posted by: Guest on April-03-2022

Code answers related to "exception handling in java code"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language