5 years ago in Java Exception Handling

What will be the output of the program?

try
{
int x = 0;
int y = 5 / x;
}
catch (Exception e)
{
System.out.println("Exception");
}
catch (ArithmeticException ae)
{
System.out.println(" Arithmetic Exception");
}
System.out.println("finished");

[A] finished
[B] Exception
[C] Compilation fails.
[D] Arithmetic Exception
Loading...
Next Question

Overall Stats

Attempted 400
Correct 126
Incorrect 130
Viewed 144

Answers

Guest
Guest
Dhruv Ghulati - 4 years ago

You should have these questions in readable code - very hard to read as is.

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 Arithmetic Exception is correct answer

Souad El
Souad El - 1 month ago

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

Salwa Nouamani
Salwa Nouamani - 1 month ago

Salwa Nouamani from Casablanca, Morocco is saying Exception is correct answer

Related Questions

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

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

To create our own exception class , we have to _______

  • [A] Extend exception class
  • [B] Create our own try and catch block
  • [C] use finally block
  • [D] Use throws keyword

parseInt() and parseLong() method throws ________________ ?

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