25 26 package java.lang; 27 28 /** 29 * Class {@code Object} is the root of the class hierarchy. 30 * Every class has {@code Object} as a superclass. All objects, 31 * including arrays, implement the methods of this class. 32 * 33 * @author unascribed 34 * @see java.lang.Class 35 * @since 1.0 36 */ 37 public class Object { 38 39 private static native void registerNatives(); 40 static { 41 registerNatives(); 42 } 43 44 /** 45 * Returns the runtime class of this {@code Object}. The returned 46 * {@code Class} object is the object that is locked by {@code 47 * static synchronized} methods of the represented class. 48 * 49 * <p><b>The actual result type is {@code Class<? extends |X|>} 50 * where {@code |X|} is the erasure of the static type of the 51 * expression on which {@code getClass} is called.</b> For 52 * example, no cast is required in this code fragment:</p> 53 * 54 * <p> 55 * {@code Number n = 0; }<br> 56 * {@code Class<? extends Number> c = n.getClass(); } 57 * </p> 58 * 59 * @return The {@code Class} object that represents the runtime 60 * class of this object. 61 * @jls 15.8.2 Class Literals 62 */ 63 public final native Class<?> getClass(); 64 | 25 26 package java.lang; 27 28 /** 29 * Class {@code Object} is the root of the class hierarchy. 30 * Every class has {@code Object} as a superclass. All objects, 31 * including arrays, implement the methods of this class. 32 * 33 * @author unascribed 34 * @see java.lang.Class 35 * @since 1.0 36 */ 37 public class Object { 38 39 private static native void registerNatives(); 40 static { 41 registerNatives(); 42 } 43 44 /** 45 * Constructs a new object. 46 */ 47 public Object() {} 48 49 /** 50 * Returns the runtime class of this {@code Object}. The returned 51 * {@code Class} object is the object that is locked by {@code 52 * static synchronized} methods of the represented class. 53 * 54 * <p><b>The actual result type is {@code Class<? extends |X|>} 55 * where {@code |X|} is the erasure of the static type of the 56 * expression on which {@code getClass} is called.</b> For 57 * example, no cast is required in this code fragment:</p> 58 * 59 * <p> 60 * {@code Number n = 0; }<br> 61 * {@code Class<? extends Number> c = n.getClass(); } 62 * </p> 63 * 64 * @return The {@code Class} object that represents the runtime 65 * class of this object. 66 * @jls 15.8.2 Class Literals 67 */ 68 public final native Class<?> getClass(); 69 |