What will be the output of the following Java program? [code] class exception_handling { public static void main(String

Pham Quỳnh

New member
What will be the output of the following Java program?
Code:
    class exception_handling 
    {
        public static void main(String args[]) 
        {
            try 
            {
                int a[] = {1, 2,3 , 4, 5};
                for (int i = 0; i < 7; ++i) 
                    System.out.print(a[i]);
            }
            catch(ArrayIndexOutOfBoundsException e) 
            {
        	System.out.print("0");        	
            }
        }
    }
A. 12345
B. 123450
C. 1234500
D. Compilation Error
 

Tìm kiếm

Back
Top