Java Fundamental Classes Reference

Previous Chapter 12
The java.lang Package
Next
 

NullPointerException

Name

NullPointerException

Synopsis

Class Name:

java.lang.NullPointerException

Superclass:

java.lang.RuntimeException

Immediate Subclasses:

None

Interfaces Implemented:

None

Availability:

JDK 1.0 or later

Description

A NullPointerException is thrown when there is an attempt to access an object through a null object reference. This can occur when there is an attempt to access an instance variable or call a method through a null object or when there is an attempt to subscript an array with a null object.

Class Summary

public class java.lang.NullPointerException 
             extends java.lang.RuntimeException {
  // Constructors
  public NullPointerException();
  public NullPointerException(String s);
}

Constructors

NullPointerException

public NullPointerException()

Description

This constructor creates a NullPointerException with no associated detail message.

public NullPointerException(String s)

Parameters

s

The detail message.

Description

This constructor creates a NullPointerException with the specified detail message.

Inherited Methods

Method

Inherited From

Method

Inherited From

clone()

Object

equals(Object)

Object

fillInStackTrace()

Throwable

finalize()

Object

getClass()

Object

getLocalizedMessage()

Throwable

getMessage()

Throwable

hashCode()

Object

notify()

Object

notifyAll()

Object

printStackTrace()

Throwable

printStackTrace(PrintStream)

Throwable

printStackTrace(PrintWriter)

Throwable

toString()

Object

wait()

Object

wait(long)

Object

wait(long, int)

Object

   

See Also

Exception, RuntimeException, Throwable


Previous Home Next
NoSuchMethodException Book Index Number

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java