The Artima Developer Community
Sponsored Link

Java Buzz Forum
What is NullPointerException in Java - Why When and How

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Javin Paul

Posts: 1090
Nickname: javinpaul
Registered: Jan, 2012

Javin Paul is Java Programmer working on Finance domain.
What is NullPointerException in Java - Why When and How Posted: Sep 26, 2012 7:53 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Javin Paul.
Original Post: What is NullPointerException in Java - Why When and How
Feed Title: Java67
Feed URL:
Feed Description: Java and technology tutorials, tips, questions for all programmers.
Latest Java Buzz Posts
Latest Java Buzz Posts by Javin Paul
Latest Posts From Java67


NullPointerException in Java is a unchecked Exception defined in java.lang package and comes when a member of a an object either field or method is called on a object which is null. null is a keyword in Java which means nothing and calling method on Object whose value is null will result in NullPointerException. Since default value of Object is null, if you call any method or access any field on an Object which is not initialized will throw NullPointerException. Some programmer get confused with name as well, Since Java does not support pointers, How can you have NullPointerException in Java? Well java.lang.NullPointerException doesn't have anything to do with pointers, it just an Exception in Java. If you look at it more deeply, NullPointerException is an unchecked Exception and it's not mandatory to provide Exception handling code for it using try, catch and finally. In fact most of NullPointerException comes because of programming errors. See most common cause of NullPointerException to find out most common scenario where NullPointerException comes in Java. In this Java article we will not only see What is NullPointerException but also How to avoid NullPointerException and How to fix java.lang.NullPointerException in Java.

Read: What is NullPointerException in Java - Why When and How

Topic: What is difference between Overloading and Overriding in Java Previous Topic   Next Topic Topic: Multiple versions of Java on OS X Mountain Lion

Sponsored Links


Copyright © 1996-2018 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use