< prev index next >

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

Print this page




  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.lang;
  27 
  28 import jdk.internal.HotSpotIntrinsicCandidate;
  29 
  30 /**
  31  * Class {@code Object} is the root of the class hierarchy.
  32  * Every class has {@code Object} as a superclass. All objects,
  33  * including arrays, implement the methods of this class.
  34  *
  35  * @author  unascribed
  36  * @see     java.lang.Class
  37  * @since   1.0
  38  */
  39 public class Object {
  40 
  41     private static native void registerNatives();
  42     static {
  43         registerNatives();
  44     }
  45 
  46     /**
  47      * Constructs a new object.
  48      */
  49     @HotSpotIntrinsicCandidate
  50     public Object() {}
  51 
  52     /**
  53      * Returns the runtime class of this {@code Object}. The returned
  54      * {@code Class} object is the object that is locked by {@code
  55      * static synchronized} methods of the represented class.
  56      *
  57      * <p><b>The actual result type is {@code Class<? extends |X|>}
  58      * where {@code |X|} is the erasure of the static type of the
  59      * expression on which {@code getClass} is called.</b> For
  60      * example, no cast is required in this code fragment:</p>
  61      *
  62      * <p>
  63      * {@code Number n = 0;                             }<br>
  64      * {@code Class<? extends Number> c = n.getClass(); }
  65      * </p>




  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.lang;
  27 
  28 import jdk.internal.HotSpotIntrinsicCandidate;
  29 
  30 /**
  31  * Class {@code Object} is the root of the class hierarchy.
  32  * Every class has {@code Object} as a superclass. All objects,
  33  * including arrays, implement the methods of this class.
  34  *
  35  * @author  unascribed
  36  * @see     java.lang.Class
  37  * @since   1.0
  38  */
  39 public class Object {
  40 





  41     /**
  42      * Constructs a new object.
  43      */
  44     @HotSpotIntrinsicCandidate
  45     public Object() {}
  46 
  47     /**
  48      * Returns the runtime class of this {@code Object}. The returned
  49      * {@code Class} object is the object that is locked by {@code
  50      * static synchronized} methods of the represented class.
  51      *
  52      * <p><b>The actual result type is {@code Class<? extends |X|>}
  53      * where {@code |X|} is the erasure of the static type of the
  54      * expression on which {@code getClass} is called.</b> For
  55      * example, no cast is required in this code fragment:</p>
  56      *
  57      * <p>
  58      * {@code Number n = 0;                             }<br>
  59      * {@code Class<? extends Number> c = n.getClass(); }
  60      * </p>


< prev index next >