-
What is the output of this program?
class Myexception extends Exception
{
int Execution;
Myexception(int n)
{
Execution = n;
}
public String toString()
{
return "Execution";
}
}
public class UserDefine_Exception
{
static void compute (int n) throws Myexception
{
throw new Myexception(n);
}
public static void main(String args[])
{
try
{
compute(5);
}
catch(Myexception e)
{
System.out.print("User define Exception executed...");
}
}
}
-
- User define Exception executed...
- Execution
- Compilation Error
- Runtime Error
- None of these
Correct Option: A
Myexception is self defined exception.