What is the output of below syntax?

Code
  1. {

  2. cath(Exception e)

  3. {System.out.println("A");

  4. }


  5. {System.out.println("b");

  6. }

  7. cath(InvalidException e2)

  8. {System.out.println("c");

  9. }

  10. finally()

  11. {

  12. System.out.println("x");

  13. }

  14.  
Copyright GeekInterview.com

Showing Answers 1 - 21 of 21 Answers

sandiraj

  • Aug 30th, 2012
 

it shows an error because we must write try before catch

kalamalla71711

  • Sep 14th, 2012
 

Must & should try with catch . catch with out try not possible. it give compilation Error.

  Was this answer useful?  Yes

avinash

  • Sep 25th, 2012
 

Compile time error because order of catching exceptions is not correct

  Was this answer useful?  Yes

Abhinav Rohatgi

  • Apr 1st, 2013
 

It is already handled by the catch block for Exception.Compilation error occurs

  Was this answer useful?  Yes

MD.Aftab Alam

  • Apr 7th, 2013
 

Compile Time Error

  Was this answer useful?  Yes

Ravi

  • Apr 16th, 2013
 

Compile Time Error..

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions