java tutorial

When to use Checked and Unchecked Exception in Java

Checked and unchecked Exception are two different types of Exception in java. both are similar in functionality and you can do all things with checked exception which are possible with unchecked exception. though there are some subtle differences like for unchecked exception you don’t
need to add explicit try catch block which pollute code in case of checked Exception.

Key point is how do you decide whether business Exception should be checked or here InsufficientFundsException can be both, share your thought on that, my go is if you have an alternative when an operation failed or chances of failing an operation is more than consider declaring it as checked Exception.

Both throw and throws can be used in conjuction with checked and unchecked Exception


read ful article at:


Leave a Reply

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

You are commenting using your 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