5 years ago in Java Exception Handling

What is the output of following try catch block try
{
int i;
return;
}
catch(Exception e)
{
System.out.println('Hello India”);
}
finally
{
System.out.println('Hello Morbi”);
}

[A] Hello India
[B] Hello India Hello Morbi
[C] Hello Morbi
[D] the program will return without printing anything
Loading...
Next Question

Overall Stats

Attempted 440
Correct 147
Incorrect 140
Viewed 153

Answers

Guest
Guest
Dhruv Ghulati - 4 years ago

http://stackoverflow.com/questions/25603507/is-it-valid-to-have-catch-block-without-try-and-finally

Dhruv Ghulati - 4 years ago

Doesn't there have to be a try block here? I thought there did if you have a catch? In which case Exception e would also be thrown?

Awa Kone
Awa Kone - 1 month ago

Awa Kone from Berrechid, Morocco is saying Hello India Hello Morbi is correct answer

ayoub benigmim
ayoub benigmim - 1 month ago

ayoub benigmim from Casablanca, Morocco is saying the program will return without printing anything is correct answer

Souad El
Souad El - 1 month ago

Souad El from Casablanca, Morocco is saying Hello Morbi is correct answer

Related Questions

Which of the following must be true of the object thrown by a throw statement?

  • [A] It must be assignable to the Throwable type
  • [B] It must be assignable to the Error type
  • [C] It must be assignable to the Exception type
  • [D] It must be assignable to the String type

What happen behind the code int a=50/0;

  • [A] object of exception class thrown
  • [B] Error in code