< prev index next >

src/java.base/share/classes/java/lang/Boolean.java

Print this page




  56      * value {@code false}.
  57      */
  58     public static final Boolean FALSE = new Boolean(false);
  59 
  60     /**
  61      * The Class object representing the primitive type boolean.
  62      *
  63      * @since   1.1
  64      */
  65     @SuppressWarnings("unchecked")
  66     public static final Class<Boolean> TYPE = (Class<Boolean>) Class.getPrimitiveClass("boolean");
  67 
  68     /**
  69      * The value of the Boolean.
  70      *
  71      * @serial
  72      */
  73     private final boolean value;
  74 
  75     /** use serialVersionUID from JDK 1.0.2 for interoperability */

  76     private static final long serialVersionUID = -3665804199014368530L;
  77 
  78     /**
  79      * Allocates a {@code Boolean} object representing the
  80      * {@code value} argument.
  81      *
  82      * @param   value   the value of the {@code Boolean}.
  83      *
  84      * @deprecated
  85      * It is rarely appropriate to use this constructor. The static factory
  86      * {@link #valueOf(boolean)} is generally a better choice, as it is
  87      * likely to yield significantly better space and time performance.
  88      * Also consider using the final fields {@link #TRUE} and {@link #FALSE}
  89      * if possible.
  90      */
  91     @Deprecated(since="9")
  92     public Boolean(boolean value) {
  93         this.value = value;
  94     }
  95 




  56      * value {@code false}.
  57      */
  58     public static final Boolean FALSE = new Boolean(false);
  59 
  60     /**
  61      * The Class object representing the primitive type boolean.
  62      *
  63      * @since   1.1
  64      */
  65     @SuppressWarnings("unchecked")
  66     public static final Class<Boolean> TYPE = (Class<Boolean>) Class.getPrimitiveClass("boolean");
  67 
  68     /**
  69      * The value of the Boolean.
  70      *
  71      * @serial
  72      */
  73     private final boolean value;
  74 
  75     /** use serialVersionUID from JDK 1.0.2 for interoperability */
  76     @java.io.Serial
  77     private static final long serialVersionUID = -3665804199014368530L;
  78 
  79     /**
  80      * Allocates a {@code Boolean} object representing the
  81      * {@code value} argument.
  82      *
  83      * @param   value   the value of the {@code Boolean}.
  84      *
  85      * @deprecated
  86      * It is rarely appropriate to use this constructor. The static factory
  87      * {@link #valueOf(boolean)} is generally a better choice, as it is
  88      * likely to yield significantly better space and time performance.
  89      * Also consider using the final fields {@link #TRUE} and {@link #FALSE}
  90      * if possible.
  91      */
  92     @Deprecated(since="9")
  93     public Boolean(boolean value) {
  94         this.value = value;
  95     }
  96 


< prev index next >