Switch to full style
General Java code examples
Post a reply

Exception handling

Tue Jan 24, 2012 10:06 am

Code:
public class S{

   public static 
void main(String args[]){
      
int a[] = new int[2];
      try{
         
System.out.println("Access element three :" a[3]);
      }catch(
ArrayIndexOutOfBoundsException e){
         
System.out.println("Exception thrown  :" e);
      }
      
finally{
         
a[0] = 6;
         
System.out.println("First element value: " +a[0]);
         
System.out.println("The finally statement is executed");
      }
   }




Post a reply
  Related Posts  to : Exception handling
 Exception Handling in a project     -  
 how to design a exception handling for a project     -  
 exception handling try and catch in Python     -  
 Exception is not clear     -  
 Out of Bounds exception     -  
 String Too Long Exception     -  
 Exception Handler in java     -  
 Multiple Exception Catching     -  
 Define your own exception class     -  
 java.security Exception in Applet     -  

Topic Tags

Java Exceptions