RE: What are the different kinds of exceptions? How do you catch a Runtime exception
1.Checked Exceptions Environmental error that cannot necessarily be detected by testing; e.g. disk full, broken socket, database unavailable, etc. 2.Errors Virtual machine error: class not found, out of memory, no such method, illegal access to private field, etc. 3.Runtime Exceptions Programming errors that should be detected in testing: index out of bounds, null pointer, illegal argument, etc.
Checked exceptions must be handled at compile time. Runtime exceptions do not need to be. Errors often cannot be
RE: What are the different kinds of exceptions? How d...
There are maily 2 types of exceptions checked and unchecked
Checked exceptions are subject to the Catch or Specify Requirement. All exceptions are checked exceptions, except for those indicated by Error, RuntimeException, and their subclasses.
Unchecked Exceptions are Errors , RuntimeErrors and its subclasses
Eg: Checked exception :When the application trying to read the contents of a file which does not exists then it throw a FileNotFoundException.
Error : Suppose that the File is Exist.But the FileReader coulnot read the file due to any system mulfunction or hard ware problems ,tehn it throw an IOError.
Error : Suppose that the File is Exist.But the FileReader coulnot read the file due to any system mulfunction or hard ware problems ,tehn it throw an IOError.
RE: What are the different kinds of exceptions? How d...
Throwable is super class for all other exception classes. of which it is divided in to two types 1)errors: unrecoverable exceptions are called errors 2)Exceptions: recoverable exceptions are called Exceptions Exceptions are classified in to 2 types 1)Checked Exceptions:exceptions caught at compile time are called are called checked Ecepotions.Examples 1)class not found exceptions 2)file not found exception 3)sql exceptions 4)IO Exceptions 2)unChecked Exceptions:exceptions caught at runtime time are called are called unchecked.Examples 1)arithematic exceptions 2)null pointer exceptions 3)array index out of bound Exception
RE: What are the different kinds of exceptions? How d...
Two kinds of exceptions:unchecked exceptions and checked exceptions.
Inside the standard java.lang package ,Java defines several exception classes. Most of the exceptions are subclasses of standard type RuntimeException. java.lang is automatically imported to programs in Java. So most exceptions derived from RuntimeException are automatically available . They need not be included in any method's throws list. Compiler does not check to see if a method handles or throws these exceptions. Such exceptions are called unchecked exceptions.
Exceptions defined by java.lang that must be included in a method's throws list are called checked exceptions.