Java Exception

Exceptions are 2 types.

1.Checked (needs to be defined in throws clause of a method) [compile]

sevlet Exception,

ClassNotFoundException,

NoSuchFieldException

FileNotFoundException

2. Uncheked (compiler doesn’t care):  [runtime]

Arithmetic Exception,

ArrayIndexOutOfBounds

NegativeArraySizeException -happens when u specify negative size for array

NumberFormat Exception -happens in the case of wrong number format

NullPointer Exception – happens if u specify a wrong or unavailable destination (since almost every method would have to declare throwing it like this

public void myMethod(String param) throws NullPointerException {
   //
}
public void myMethod(String param) throws NullPointerException {
   //
}

)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s