Home » JAVA Programming » Exceptions » Question
  1. What is the output of this program?
    class Newexception extends Exception 
    {
    int Execution;
    Newexception(int p)
    {
    Execution = p;
    }
    public String toString()
    {
    return "Execution";
    }
    }

    public class Output
    {
    static void compute (int p) throws Newexception
    {
    throw new Newexception(p);
    }
    public static void main(String args[])
    {
    try
    {
    compute(13);
    }
    catch(Exception e)
    {
    System.out.print("Newexception working proper...");
    }
    }
    }
    1. Newexception
    2. Execution
    3. Newexception working proper...
    4. Runtime Error
    5. None of these
Correct Option: C

Newexception is self defined exception.



Your comments will be displayed only after manual approval.