What are different types of Exceptions?.

Answer Posted / gagan jain

common exceptions:
Java has several predefines exceptions. the most common
exceptions that you may encounter are described below.

Arithmetic Exception:-
This exception is thrown when an exceptional arithmetic
condition has occurred. for example, a division by zero
generates such an exception.

Nullpointer Exception:-
This exception is thrown when an application attempts to
use null where an object is required. An object that has
not been allocated memory holds a null value. the
situations in which an exception is thrown include:
1. Using an object without allocating memory for it.
2. Calling the methods of a null object.
3. Accessing or modifying the attributes of null obect.

ArrayIndexoutof Bounds Exception
The exception Arrayindexoutofbounds Exceptions is thrown
when an attempt is made to access an array element beyond
the index of the array. for example, if you try to access
the eleventh element of an array that's has only ten
elements, the exception will be thrown.

Is This Answer Correct ?    16 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the access modifiers in java?

574


What is a map in java?

535


Is int primitive data type?

499


What is http client in java?

509


What is autoboxing and unboxing?

569






What is an class?

579


What is null mean in java?

611


What is the importance of hashcode() and equals() methods?

568


What are selection structures?

527


What is a function argument in java?

505


What is javac used for?

503


Where are register variables stored?

579


take an array with -ve and +ve value both.find out the nearest value of 0(zero).if two values are same like(-2 and +2)then extract +2 is nearest of 0(zero).

1522


Explain, java is compatible with all servers but not all browsers?

594


What is the difference between a local variable and an instance variable?

534