Exceptions
- Which of these methods return description of an exception?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
getMessage() returns a description of the exception.
- Which of these methods is used to print stack trace?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
printStackTrace()
- Which of these methods return localized description of an exception?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
getLocalizedMessage()
- Which of these classes is super class of Exception class?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Throwable
- 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...");
}
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Myexception is self defined exception.