5 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 309
Correct 103
Incorrect 81
Viewed 125

Answers

Guest
Guest
Awa Kone
Awa Kone - 1 month ago

Awa Kone from Berrechid, Morocco is saying Compilation fails is correct answer

ayoub benigmim
ayoub benigmim - 1 month ago

ayoub benigmim from Casablanca, Morocco is saying finally exception finished is correct answer

Souad El
Souad El - 1 month ago

Souad El from Casablanca, Morocco is saying finally exception finished is correct answer

Salwa Nouamani
Salwa Nouamani - 1 month ago

Salwa Nouamani from Casablanca, Morocco is saying finally exception finished is correct answer

Cos Sinus
Cos Sinus - 1 month ago

Cos Sinus from Casablanca, Morocco is saying finally exception finished is correct answer

Related Questions

parseInt() and parseLong() method throws ________________ ?

  • [A] ArithmeticException
  • [B] ClassNotFoundException
  • [C] NullPointerException
  • [D] NumberFormatException

The exception class is in ____ package

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

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

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