Java’s Checked and Unchecked Exceptions- demystified

Until recent­ly, I had hard time remem­ber­ing what is the dif­fer­ence between checked and unchecked excep­tions.

Final­ly Head First Java gave me the prompt expla­na­tion. Here it goes:

Checked Excep­tions: Arise due to the rea­sons which are beyond con­trol of pro­gram­mer so com­pli­er man­dates them to han­dle or declare.

Unchecked Excep­tions: Aris­es due to log­ic flaws in the code.So these should be eliminated.Exception Han­dling mech­a­nism is not sup­posed to take care of pro­gram­mer inject­ed log­ic flaws in the code.So com­pli­er wont bother.It is the respon­si­bil­i­ty of the pro­gram­mer to elim­i­nate them.

I am also look­ing for sim­i­lar kind of prompt and clear expla­na­tion for the dif­fer­ence between Error and Excep­tion.If you get to know, I appre­ci­ate if you can share with me.



Leave a Reply

%d bloggers like this: