V

Vinay • 28.75K Points
Instructor II

Q. What will be the output of the following Java program?
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
  • Correct Answer - Option(B)
  • Views: 11
  • Filed under category JAVA

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics