Monday, 22 August 2011

Exceptions

Exceptions and Errors in Java
   To start with exceptions, we have to understand the difference between the Exceptions and Errors in java.
     In Java, Error and Exception can be differentiated based on the program control. Error cannot be controlled by the programmer whereas Exceptions are those that can be guessed and also handled easily. 

For example,
    The OutOfMemory error that occurring due to large size of input is an error and it can be handled only by the system dynamically.
    In other case, consider accessing an array value that is out of range can be guessed by the programmer and handled using  ArrayOutOfBoundsException.

 

No comments:

Post a Comment