<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Java null and NullPointerException</title>
	<atom:link href="http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/feed/" rel="self" type="application/rss+xml" />
	<link>http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/</link>
	<description>Blog on core java, servlets, jsp and design patterns.</description>
	<lastBuildDate>Mon, 04 Jun 2012 02:04:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Java Class Loader</title>
		<link>http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/#comment-9928</link>
		<dc:creator>Java Class Loader</dc:creator>
		<pubDate>Sun, 12 Feb 2012 13:35:50 +0000</pubDate>
		<guid isPermaLink="false">http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/#comment-9928</guid>
		<description>[...] NullPointerException, one exception that is very popular is ClassNotFoundException. At least in your beginner stage you [...]</description>
		<content:encoded><![CDATA[<p>[...] NullPointerException, one exception that is very popular is ClassNotFoundException. At least in your beginner stage you [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaurav Pratap Singh</title>
		<link>http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/#comment-7571</link>
		<dc:creator>Gaurav Pratap Singh</dc:creator>
		<pubDate>Fri, 23 Sep 2011 11:56:23 +0000</pubDate>
		<guid isPermaLink="false">http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/#comment-7571</guid>
		<description>there are some point to check null pointer exceptions
 
1# Instance level object reference (non-primitive) implicitly initialize with null so no need to initialize these references.

2# NullPonter occurs when we use variable (reference) before initialize it, So avoid calling before initialize.

3# First check the reference of the variable and then method.
for example :

ArrayList arr = new ArrayList();
/*
 * business code here 
 */
if(null != arrr &amp;&amp; arr.size() &gt; 0)
{//some code}

4# always use null in left side 
it will increase your code performance.
Example:

AA aa = new AA();
if(null!= aa)

5# avoid use of size() method in collections just use isEmpty() method.

ArrayList arr = new ArrayList();
/*
 * business code here 
 */
if(null != arrr &amp;&amp; !arr.isEmpty())
{//some code}   

6# if you need to check multiple methods 
check for each one
Example

if(null != aa &amp;&amp; null != aa.method1() &amp;&amp; null != aa.method1().method2())
//and so on</description>
		<content:encoded><![CDATA[<p>there are some point to check null pointer exceptions</p>
<p>1# Instance level object reference (non-primitive) implicitly initialize with null so no need to initialize these references.</p>
<p>2# NullPonter occurs when we use variable (reference) before initialize it, So avoid calling before initialize.</p>
<p>3# First check the reference of the variable and then method.<br />
for example :</p>
<p>ArrayList arr = new ArrayList();<br />
/*<br />
 * business code here<br />
 */<br />
if(null != arrr &amp;&amp; arr.size() &gt; 0)<br />
{//some code}</p>
<p>4# always use null in left side<br />
it will increase your code performance.<br />
Example:</p>
<p>AA aa = new AA();<br />
if(null!= aa)</p>
<p>5# avoid use of size() method in collections just use isEmpty() method.</p>
<p>ArrayList arr = new ArrayList();<br />
/*<br />
 * business code here<br />
 */<br />
if(null != arrr &amp;&amp; !arr.isEmpty())<br />
{//some code}   </p>
<p>6# if you need to check multiple methods<br />
check for each one<br />
Example</p>
<p>if(null != aa &amp;&amp; null != aa.method1() &amp;&amp; null != aa.method1().method2())<br />
//and so on</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paja</title>
		<link>http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/#comment-7445</link>
		<dc:creator>Paja</dc:creator>
		<pubDate>Tue, 13 Sep 2011 09:34:08 +0000</pubDate>
		<guid isPermaLink="false">http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/#comment-7445</guid>
		<description>Hi, thanks for the post. Another possibility is to have a look at the Null object GoF pattern? It may be a good step to prevent from Null pointers.</description>
		<content:encoded><![CDATA[<p>Hi, thanks for the post. Another possibility is to have a look at the Null object GoF pattern? It may be a good step to prevent from Null pointers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinesh</title>
		<link>http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/#comment-4728</link>
		<dc:creator>Dinesh</dc:creator>
		<pubDate>Thu, 28 Apr 2011 06:09:20 +0000</pubDate>
		<guid isPermaLink="false">http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/#comment-4728</guid>
		<description>public static void main(String args[]) {
 
	  String str = null;
	  
	  try{
		  System.out.println(str.length());
	  }
	  catch(NullPointerException ne)
	  {
		  System.out.println(&quot;nullpointerexception&quot;);
	  }
  }
}

//output : nullpointerexception</description>
		<content:encoded><![CDATA[<p>public static void main(String args[]) {</p>
<p>	  String str = null;</p>
<p>	  try{<br />
		  System.out.println(str.length());<br />
	  }<br />
	  catch(NullPointerException ne)<br />
	  {<br />
		  System.out.println(&#8220;nullpointerexception&#8221;);<br />
	  }<br />
  }<br />
}</p>
<p>//output : nullpointerexception</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seeni</title>
		<link>http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/#comment-2724</link>
		<dc:creator>seeni</dc:creator>
		<pubDate>Thu, 09 Dec 2010 14:06:30 +0000</pubDate>
		<guid isPermaLink="false">http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/#comment-2724</guid>
		<description>i have tried my coding using try catch black but i have null pointer exception</description>
		<content:encoded><![CDATA[<p>i have tried my coding using try catch black but i have null pointer exception</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mitesh Agrawal</title>
		<link>http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/#comment-2679</link>
		<dc:creator>Mitesh Agrawal</dc:creator>
		<pubDate>Mon, 29 Nov 2010 11:27:56 +0000</pubDate>
		<guid isPermaLink="false">http://javapapers.com/core-java/nullpointerexception-null-bad-good-and-ugly/#comment-2679</guid>
		<description>Can&#039;t we handle NullPointerException by putting our code within try-catch block</description>
		<content:encoded><![CDATA[<p>Can&#8217;t we handle NullPointerException by putting our code within try-catch block</p>
]]></content:encoded>
	</item>
</channel>
</rss>

