GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  J2EE  >  Core Java

 Print  |  
Question:  Exception Handling

Answer: What is the output of the following program, When tested under JDK 5.0

class ExceptionDemo
{
public static void main(String[] args)
{
int a[] = new int[] {1,2,3,4,5};
try{
System.out.prinltln(a[6]);
} catch(Exception e) {
System.out.println("Catching Exception ...");
} catch(ArrayIndexOutofBoundsException ae) {
System.out.println("Catching ArrayIndexOutOfBounds Exception ...");
}
}
}





April 04, 2008 08:43:23 #2
 abuthahir.d   Member Since: January 2008    Total Comments: 10 

RE: Exception Handling
 

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

Unreachable catch block for ArrayIndexOutOfBoundsException. It is already handled by the catch block for Exception


this the error i got

     

 

Back To Question