How does a try statement determine which catch clause should be used to handle an exception ?


When an exception is thrown within the body of a try statement, the catch clauses of the try statement are examined in the order in which they appear. The first catch clause that is capable of handling the exceptionis executed. The remaining catch clauses are ignored.



Explore posts in the same categories: Java Interview Questions


BOOKMARK THIS : del.icio.us | Digg it | Furl | reddit |


Related Questions :

  • What classes of exceptions may be caught by a catch clause?
  • A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and...
  • What classes of exceptions may be caught by a catch clause?
  • A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and...
  • What’s the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception ?
  • A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this...
  • What’s the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception ?
  • A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this...
  • What is the basic difference between the 2 approaches to exception handling…1> try catch block and 2> specifying the candidate exceptions in the throws clause? When should you use which approach ?
  • In the first approach as a programmer of the method, you urself are dealing with the exception. This is fine...
  • When is the finally clause of a try-catch-finally statement executed?
  • The finally clause of the try-catch-finally statement is always executed unless the thread of execution terminates or an exception occurs...
  • When is the finally clause of a try-catch-finally statement executed?
  • The finally clause of the try-catch-finally statement is always executed unless the thread of execution terminates or an exception occurs...
  • What is the purpose of the finally clause of a try-catch-finally statement?
  • The finally clause is used to provide the capability to execute code no matter whether or not an exception is...
  • What is the purpose of the finally clause of a try-catch-finally statement?
  • The finally clause is used to provide the capability to execute code no matter whether or not an exception is...
  • What’s the C# syntax to catch any possible exception?
  • A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in...

    Comments are closed.