Exceptions


  1. Which of these methods return description of an exception?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    getMessage() returns a description of the exception.


  1. Which of these methods is used to print stack trace?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    printStackTrace()



  1. Which of these methods return localized description of an exception?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    getLocalizedMessage()


  1. Which of these classes is super class of Exception class?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Throwable



  1. 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...");
    }
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Myexception is self defined exception.