Q. What will be the output of the following Java code?

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
  • (D) Compilation Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) Runtime Error

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
160
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Neelam Mittal
Publisher
πŸ“ˆ
89%
Success Rate