1 /* 2 * @(#)NullPointerException.java 1.19 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package java.lang; 9 10 /** 11 * Thrown when an application attempts to use <code>null</code> in a 12 * case where an object is required. These include: 13 * <ul> 14 * <li>Calling the instance method of a <code>null</code> object. 15 * <li>Accessing or modifying the field of a <code>null</code> object. 16 * <li>Taking the length of <code>null</code> as if it were an array. 17 * <li>Accessing or modifying the slots of <code>null</code> as if it 18 * were an array. 19 * <li>Throwing <code>null</code> as if it were a <code>Throwable</code> 20 * value. 21 * </ul> 22 * <p> 23 * Applications should throw instances of this class to indicate 24 * other illegal uses of the <code>null</code> object. 25 * 26 * @author unascribed 27 * @version 1.19, 12/19/03 28 * @since JDK1.0 29 */ 30 public 31 class NullPointerException extends RuntimeException { 32 /** 33 * Constructs a <code>NullPointerException</code> with no detail message. 34 */ 35 public NullPointerException() { 36 super(); 37 } 38 39 /** 40 * Constructs a <code>NullPointerException</code> with the specified 41 * detail message. 42 * 43 * @param s the detail message. 44 */ 45 public NullPointerException(String s) { 46 super(s); 47 } 48 } 49