Posts

Showing posts from September, 2014

Exceptions and exceptional handling

Exceptions: What are exceptions you may ask,exceptions are flaws in the programs that are to be taken care of.They disturb the normal flow of the program and creates serious problems if not handled properly.They can be run-time or compile time or you may say unchecked or checked exceptions.But what are errors then,exceptions that cannot be recovered  are called errors.For example:Programmer has declared an array of objects of string class of size n,but has inserted greater than n value,its an array-index-out-of-bound exception,or if called the method of a class that neither exist on the package.There are lots of predefined exceptions in java including them.  There are basically two types of exceptions as I said,checked and unchecked exceptions. Checked exceptions are notified while compiling the program,i.e. the compiler checks that it would cause further problem,that's why they are called checked exceptions.Examples are:IOExeption,sqlException. Unchecked exceptions are non-