Thursday, August 27, 2009

Java - Resolving NullPointerException

In Java, the NullPointerException (NPE) is generally a simple exception to resolve. In very basic terms, it means that one is trying to access a property or call a method on an object that does not exist. Read the error message to find the line where the NPE occurred. Examine that line to determine which reference is a likely candidate to be null. Dig a little deeper to find out why that reference is null and fix the application to either ensure the reference is not null or to handle the reference gracefully if it is null.

No comments:

Post a Comment