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

Overall Stats

Attempted 317
Correct 106
Incorrect 83
Viewed 128

Answers

Guest
Guest
MOUAD BOUKNITER
MOUAD BOUKNITER - 1 month ago

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

ihsane KHALLOUQ
ihsane KHALLOUQ - 1 month ago

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

Bharath
Bharath - 4 months ago

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

shubham adne
shubham adne - 6 months ago

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

May Phyo
May Phyo - 7 months ago

May Phyo is saying finally is correct answer

Related Questions

The exception class is in ____ package

  • [A] java.file
  • [B] java.io
  • [C] java.lang
  • [D] java.util