Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Java Exceptions Questions

Java Exceptions Questions

Ratings: (0)|Views: 96|Likes:
Published by api-3736604

More info:

Published by: api-3736604 on Oct 17, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





Java Exceptions Questions
Explain the user defined Exceptions?

User defined Exceptions are custom Exception classes defined by the user for specific purpose. A
user defined exception can be created by simply sub-classing an Exception class or a subclass of
an Exception class. This allows custom exceptions to be generated (using throw clause) and
caught in the same way as normal exceptions.

class CustomException extends Exception {
}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 Exception types. Errors are generally irrecoverable conditions
What is the difference between exception and error?
Error's are irrecoverable exceptions. Usually a program terminates when an error is encountered.
What is the difference between throw and throws keywords?

The throw keyword denotes a statement that causes an exception to be initiated. It takes the
Exception object to be thrown as an argument. The exception will be caught by an enclosing try-
catch block or propagated further up the calling hierarchy. The throws keyword is a modifier of a
method that denotes that an exception may be thrown by the method. An exception can be

What class of exceptions are generated by the Java run-time system?
The Java runtime system generates Runtime Exceptions and Errors.
What is the base class for Error and Exception?
What are Checked and Unchecked Exceptions?

A checked exception is some subclass of Exception (or Exception itself), excluding class
RuntimeException and its subclasses. Making an exception checked forces client programmers
to deal with the exception may be thrown. Checked exceptions must be caught at compile time.
Example: IOException.
Unchecked exceptions are RuntimeException and any of its subclasses. Class Error and its
subclasses also are unchecked. With an unchecked exception, however, the compiler doesn't
force client programmers either to catch the exception or declare it in a throws clause. In fact,
client programmers may not even know that the exception could be thrown. Example:
ArrayIndexOutOfBoundsException. Errors are often irrecoverable conditions.

Activity (10)

You've already reviewed this. Edit your review.
1 hundred reads
murthy_oct24 liked this
rajaramansuresh liked this
manojrane liked this
rajesh_balina liked this
GuruMuruga liked this
RajPJ liked this
RajPJ liked this
kiri liked this
paonethestar liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->