6 years ago in Java Exception Handling

What will be the output of the program?

public class Test
{
public static void aMethod() throws Exception
{
try /* Line 5 */
{
throw new Exception(); /* Line 7 */
}
finally /* Line 9 */
{
System.out.print("finally "); /* Line 11 */
}
}
public static void main(String args[])
{
try
{
aMethod();
}
catch (Exception e) /* Line 20 */
{
System.out.print("exception ");
}
System.out.print("finished"); /* Line 24 */
}
}

[A] finally
[B] exception finished
[C] finally exception finished
[D] Compilation fails
Loading...
Next Question

Create your Digital Resume For FREE on your name's sub domain "yourname.wcard.io". Register Here!


Overall Stats

Attempted 320
Correct 106
Incorrect 84
Viewed 130

Answers

Guest
Guest
Yesu Bandaru
Yesu Bandaru - 3 months ago

Yesu Bandaru is saying exception finished is correct answer

MOUAD BOUKNITER
MOUAD BOUKNITER - 7 months ago

MOUAD BOUKNITER from Casablanca, Morocco is saying finally exception finished is correct answer

ihsane KHALLOUQ
ihsane KHALLOUQ - 7 months ago

ihsane KHALLOUQ from Casablanca, Morocco is saying finally exception finished is correct answer

Bharath
Bharath - 9 months ago

Bharath from Hyderabad, India is saying finally exception finished is correct answer

shubham adne
shubham adne - 11 months ago

shubham adne from Pune, India is saying exception finished is correct answer

Related Questions

String s="abc"; Integer i=Integer.parseInt(s); what is output?

  • [A] Runtime Exception
  • [B] number Formate Exception

In case of multiple catch blocks,______

  • [A] The superclass exception must be caught first
  • [B] The superclass exception can not caught first
  • [C] Either super or subclass can be caught first.
  • [D] None of these

If a statement tries to divide by zero which exception is thrown?

  • [A] ArithemticException
  • [B] NullPointerException
  • [C] NumberFormatException
  • [D] None of these

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

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