Vidyalelo
Java Programming · Q109

Exceptions

Programming · Java Programming · question 109

Q109

What will be the output of the following Java code? class Myexception extends Exception int detail; Myexception(int a) detail = a; public String toString() return "detail"; class Output static void compute (int a) throws Myexception throw new Myexception(a); public static void main(String args[]) try compute(3); catch(DevideByZeroException e) System.out.print("Exception");

A.
3
B.
Exception
C.
Runtime Error
Answer
D.
Compilation Error

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board