<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/">

<channel>
	<title>exception Archives - Manish Sanger</title>
	<atom:link href="https://www.manishsanger.com/tag/exception/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.manishsanger.com/tag/exception/</link>
	<description>Java, J2EE, Spring Framework, application security,big data,database,design patterns,hibernate,j2ee,java,jdbc,micro-services,mongodb,multithreading,nosql</description>
	<lastBuildDate>Wed, 28 Mar 2018 11:45:40 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
	<item>
		<title>Java Exception Hierarchy</title>
		<link>https://www.manishsanger.com/java-exception-hierarchy/</link>
					<comments>https://www.manishsanger.com/java-exception-hierarchy/#respond</comments>
		
		<dc:creator><![CDATA[manishsanger]]></dc:creator>
		<pubDate>Wed, 28 Mar 2018 11:45:40 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[exception]]></category>
		<guid isPermaLink="false">https://www.manishsanger.com/?p=353</guid>

					<description><![CDATA[<p>As shown in the exception hierarchy, a Throwable class is a superclass of all errors and exceptions in Java. Objects those are instances of Throwable or one of its subclasses are thrown by JVM or by Java throw statement. Error: An Error is a subclass of Throwable that represents serious errors that can&#8217;t be handled. [&#8230;]</p>
<p>The post <a href="https://www.manishsanger.com/java-exception-hierarchy/">Java Exception Hierarchy</a> appeared first on <a href="https://www.manishsanger.com">Manish Sanger</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div id="attachment_354" style="width: 657px" class="wp-caption alignnone"><a href="https://www.manishsanger.com/wp-content/uploads/2018/03/Exception-Hierarchy.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-354" class="size-full wp-image-354" src="https://www.manishsanger.com/wp-content/uploads/2018/03/Exception-Hierarchy.png" alt="Java Exception Hierarchy" width="647" height="593" srcset="https://www.manishsanger.com/wp-content/uploads/2018/03/Exception-Hierarchy.png 647w, https://www.manishsanger.com/wp-content/uploads/2018/03/Exception-Hierarchy-300x275.png 300w" sizes="(max-width: 647px) 100vw, 647px" /></a><p id="caption-attachment-354" class="wp-caption-text">Java Exception Hierarchy</p></div>
<p>As shown in the exception hierarchy, a <em>Throwable</em> class is a superclass of all errors and exceptions in Java. Objects those are instances of <em>Throwable</em> or one of its subclasses are thrown by JVM or by Java throw statement.</p>
<p><span style="text-decoration: underline;"><strong>Error:</strong></span><br />
An Error is a subclass of <em>Throwable</em> that represents serious errors that can&#8217;t be handled. A method is not required to declare throws clause for Error or any of its subclasses for the errors thrown during execution of the method but not caught.</p>
<p>Error and its subclasses are unchecked exceptions.<br />
Here are the examples of errors: OutOfMemoryError, StackOverflowError, AssertionError, IOError, NoClassDefFoundError etc.</p>
<p><span style="text-decoration: underline;"><strong>Exception:</strong></span><br />
Exception is a subclass of <em>Throwable</em>. Exception and its subclasses represent the problems from which a program can recover and should be handled by the application.<br />
Exception has two sub type:</p>
<p>1. <span style="text-decoration: underline;"><strong>RunTimeException or Unchecked Exception:</strong></span><br />
The classes that extends <em>RunTimeException</em> are called unchecked Exception. An unchecked exception occurs at run-time, it can&#8217;t be checked at compile time, an application should handle these exceptions. For example: NullPointerException, ArithmeticException, IllegalArgumentException, IndexOutOfBoundException etc.</p>
<p><span style="text-decoration: underline;"><strong>2. Checked Exception:</strong></span><br />
The classes that extends Throwable class except RunTimeExpception and Error are called Checked Exception. Checked exception are checked at compile time and application should handle these exceptions. For example: IOException, SQLException, FileNotFoundException, ClassNotFoundException, NoSuchMethodException etc.</p>
<p><span style="text-decoration: underline;"><strong>User-defined custom exception:</strong></span><br />
We can also create our own exception. Here are few rules:<br />
1. All exception must be a child of Throwable.<br />
2. To create a RuntimeException, we need to extend the RunTimeException class.<br />
3. To create the checked exception, we need to extend the Exception class.</p>
<p><span style="text-decoration: underline;"><strong>Reference:</strong></span><br />
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html" target="_blank">https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html</a><br />
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Error.html" target="_blank">https://docs.oracle.com/javase/8/docs/api/java/lang/Error.html</a></p>
<p>The post <a href="https://www.manishsanger.com/java-exception-hierarchy/">Java Exception Hierarchy</a> appeared first on <a href="https://www.manishsanger.com">Manish Sanger</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.manishsanger.com/java-exception-hierarchy/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<enclosure url="https://www.manishsanger.com/wp-content/uploads/2018/03/Exception-Hierarchy.png" length="35275" type="image/png"/><media:content url="https://www.manishsanger.com/wp-content/uploads/2018/03/Exception-Hierarchy.png" width="647" height="593" medium="image" type="image/png"/>	</item>
	</channel>
</rss>
