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 ...");
}
}
}





July 07, 2008 02:18:12 #10
 vanigeetha   Member Since: January 2008    Total Comments: 4 

RE: Exception Handling
 
I got this program in compilation error.

ArrayIndexOutOfBoundException is UnCheckedException, but i got error in compile time. Compile time exceptions are Checked Exception. I need Correct ans. plz send my mail id
     

 

Back To Question