src/share/classes/java/lang/NullPointerException.java

Print this page
rev 10048 : 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
Reviewed-by:


  30  * case where an object is required. These include:
  31  * <ul>
  32  * <li>Calling the instance method of a {@code null} object.
  33  * <li>Accessing or modifying the field of a {@code null} object.
  34  * <li>Taking the length of {@code null} as if it were an array.
  35  * <li>Accessing or modifying the slots of {@code null} as if it
  36  *     were an array.
  37  * <li>Throwing {@code null} as if it were a {@code Throwable}
  38  *     value.
  39  * </ul>
  40  * <p>
  41  * Applications should throw instances of this class to indicate
  42  * other illegal uses of the {@code null} object.
  43  *
  44  * {@code NullPointerException} objects may be constructed by the
  45  * virtual machine as if {@linkplain Throwable#Throwable(String,
  46  * Throwable, boolean, boolean) suppression were disabled and/or the
  47  * stack trace was not writable}.
  48  *
  49  * @author  unascribed
  50  * @since   JDK1.0
  51  */
  52 public
  53 class NullPointerException extends RuntimeException {
  54     private static final long serialVersionUID = 5162710183389028792L;
  55 
  56     /**
  57      * Constructs a {@code NullPointerException} with no detail message.
  58      */
  59     public NullPointerException() {
  60         super();
  61     }
  62 
  63     /**
  64      * Constructs a {@code NullPointerException} with the specified
  65      * detail message.
  66      *
  67      * @param   s   the detail message.
  68      */
  69     public NullPointerException(String s) {
  70         super(s);


  30  * case where an object is required. These include:
  31  * <ul>
  32  * <li>Calling the instance method of a {@code null} object.
  33  * <li>Accessing or modifying the field of a {@code null} object.
  34  * <li>Taking the length of {@code null} as if it were an array.
  35  * <li>Accessing or modifying the slots of {@code null} as if it
  36  *     were an array.
  37  * <li>Throwing {@code null} as if it were a {@code Throwable}
  38  *     value.
  39  * </ul>
  40  * <p>
  41  * Applications should throw instances of this class to indicate
  42  * other illegal uses of the {@code null} object.
  43  *
  44  * {@code NullPointerException} objects may be constructed by the
  45  * virtual machine as if {@linkplain Throwable#Throwable(String,
  46  * Throwable, boolean, boolean) suppression were disabled and/or the
  47  * stack trace was not writable}.
  48  *
  49  * @author  unascribed
  50  * @since   1.0
  51  */
  52 public
  53 class NullPointerException extends RuntimeException {
  54     private static final long serialVersionUID = 5162710183389028792L;
  55 
  56     /**
  57      * Constructs a {@code NullPointerException} with no detail message.
  58      */
  59     public NullPointerException() {
  60         super();
  61     }
  62 
  63     /**
  64      * Constructs a {@code NullPointerException} with the specified
  65      * detail message.
  66      *
  67      * @param   s   the detail message.
  68      */
  69     public NullPointerException(String s) {
  70         super(s);