/*
* Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package java.lang;
/**
* Class {@code Object} is the root of the class hierarchy.
* Every class has {@code Object} as a superclass. All objects,
* including arrays, implement the methods of this class.
*
* @author unascribed
* @see java.lang.Class
* @since JDK1.0
*/
public class Object {
private static native void registerNatives();
static {
registerNatives();
}
/**
* Returns the runtime class of this {@code Object}. The returned
* {@code Class} object is the object that is locked by {@code
* static synchronized} methods of the represented class.
*
* <p><b>The actual result type is {@code Class<? extends |X|>}
* where {@code |X|} is the erasure of the static type of the
* expression on which {@code getClass} is called.</b> For
* example, no cast is required in this code fragment:</p>
*
* <p>
* {@code Number n = 0; }<br>
* {@code Class<? extends Number> c = n.getClass(); }
* </p>
*
* @return The {@code Class} object that represents the runtime
* class of this object.
* @jls 15.8.2 Class Literals
*/
public final native Class<?> getClass();
/**
* Returns a hash code value for the object. This method is
* supported for the benefit of hash tables such as those provided by
* {@link java.util.HashMap}.
* <p>
* The general contract of {@code hashCode} is:
* <ul>
* <li>Whenever it is invoked on the same object more than once during
* an execution of a Java application, the {@code hashCode} method
* must consistently return the same integer, provided no information
* used in {@code equals} comparisons on the object is modified.
* This integer need not remain consistent from one execution of an
* application to another execution of the same application.
* <li>If two objects are equal according to the {@code equals(Object)}
* method, then calling the {@code hashCode} method on each of
* the two objects must produce the same integer result.
* <li>It is <em>not</em> required that if two objects are unequal
* according to the {@link java.lang.Object#equals(java.lang.Object)}
* method, then calling the {@code hashCode} method on each of the
* two objects must produce distinct integer results. However, the
* programmer should be aware that producing distinct integer results
* for unequal objects may improve the performance of hash tables.
* </ul>
* <p>
* As much as is reasonably practical, the hashCode method defined by
* class {@code Object} does return distinct integers for distinct
* objects. (This is typically implemented by converting the internal
* address of the object into an integer, but this implementation
* technique is not required by the
* Java™ programming language.)
*
* @return a hash code value for this object.
* @see java.lang.Object#equals(java.lang.Object)
* @see java.lang.System#identityHashCode
*/
public native int hashCode();
/**
* Indicates whether some other object is "equal to" this one.
* <p>
* The {@code equals} method implements an equivalence relation
* on non-null object references:
* <ul>
* <li>It is <i>reflexive</i>: for any non-null reference value
* {@code x}, {@code x.equals(x)} should return
* {@code true}.
* <li>It is <i>symmetric</i>: for any non-null reference values
* {@code x} and {@code y}, {@code x.equals(y)}
* should return {@code true} if and only if
* {@code y.equals(x)} returns {@code true}.
* <li>It is <i>transitive</i>: for any non-null reference values
* {@code x}, {@code y}, and {@code z}, if
* {@code x.equals(y)} returns {@code true} and
* {@code y.equals(z)} returns {@code true}, then
* {@code x.equals(z)} should return {@code true}.
* <li>It is <i>consistent</i>: for any non-null reference values
* {@code x} and {@code y}, multiple invocations of
* {@code x.equals(y)} consistently return {@code true}
* or consistently return {@code false}, provided no
* information used in {@code equals} comparisons on the
* objects is modified.
* <li>For any non-null reference value {@code x},
* {@code x.equals(null)} should return {@code false}.
* </ul>
* <p>
* The {@code equals} method for class {@code Object} implements
* the most discriminating possible equivalence relation on objects;
* that is, for any non-null reference values {@code x} and
* {@code y}, this method returns {@code true} if and only
* if {@code x} and {@code y} refer to the same object
* ({@code x == y} has the value {@code true}).
* <p>
* Note that it is generally necessary to override the {@code hashCode}
* method whenever this method is overridden, so as to maintain the
* general contract for the {@code hashCode} method, which states
* that equal objects must have equal hash codes.
*
* @param obj the reference object with which to compare.
* @return {@code true} if this object is the same as the obj
* argument; {@code false} otherwise.
* @see #hashCode()
* @see java.util.HashMap
*/
public boolean equals(Object obj) {
return (this == obj);
}
/**
* Creates and returns a copy of this object. The precise meaning
* of "copy" may depend on the class of the object. The general
* intent is that, for any object {@code x}, the expression:
* <blockquote>
* <pre>
* x.clone() != x</pre></blockquote>
* will be true, and that the expression:
* <blockquote>
* <pre>
* x.clone().getClass() == x.getClass()</pre></blockquote>
* will be {@code true}, but these are not absolute requirements.
* While it is typically the case that:
* <blockquote>
* <pre>
* x.clone().equals(x)</pre></blockquote>
* will be {@code true}, this is not an absolute requirement.
* <p>
* By convention, the returned object should be obtained by calling
* {@code super.clone}. If a class and all of its superclasses (except
* {@code Object}) obey this convention, it will be the case that
* {@code x.clone().getClass() == x.getClass()}.
* <p>
* By convention, the object returned by this method should be independent
* of this object (which is being cloned). To achieve this independence,
* it may be necessary to modify one or more fields of the object returned
* by {@code super.clone} before returning it. Typically, this means
* copying any mutable objects that comprise the internal "deep structure"
* of the object being cloned and replacing the references to these
* objects with references to the copies. If a class contains only
* primitive fields or references to immutable objects, then it is usually
* the case that no fields in the object returned by {@code super.clone}
* need to be modified.
* <p>
* The method {@code clone} for class {@code Object} performs a
* specific cloning operation. First, if the class of this object does
* not implement the interface {@code Cloneable}, then a
* {@code CloneNotSupportedException} is thrown. Note that all arrays
* are considered to implement the interface {@code Cloneable} and that
* the return type of the {@code clone} method of an array type {@code T[]}
* is {@code T[]} where T is any reference or primitive type.
*
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
自学资料,自学练习、
JAVA-SE-学习 全面打基础练习和文档集合.合集准备
Java学习资料
(545个子文件)
.gitignore 215B
desktop.ini 141B
fastjson-1.2.58.jar 625KB
dom4j-1.6.jar 306KB
dom4j-1.6.jar 306KB
commons-lang-2.4.jar 256KB
jaxen-1.1-beta-6.jar 239KB
gson-2.8.5.jar 236KB
junit-4.8.2.jar 232KB
json-20180813.jar 63KB
json-20180813.jar 63KB
FlowerMgr.java 10KB
双色球练习5.java 10KB
OutputStream的了解与应用01.java 9KB
LinkedList.java 9KB
双色球练习4.java 8KB
P1反射的坑.java 8KB
ReflectUtils.java 7KB
缓存字符输入输出流.java 7KB
ArrayList.java 7KB
P3全双工通信.java 6KB
Collection基础使用.java 6KB
HashMap初级引入.java 6KB
For06利用嵌套循环打印图案.java 6KB
万年历练习.java 5KB
JSON.java 5KB
StringBuffer的基础应用.java 5KB
Student.java 5KB
HashMap.java 5KB
FileInputStream了解与使用.java 5KB
p2合入线程.java 5KB
P1元注解.java 5KB
StringBuilder的基础应用.java 4KB
Collection与Map的集合总结.java 4KB
文件字符流读与写.java 4KB
StringBuilder类详解.java 4KB
TestCase.java 4KB
TreeMap测试.java 4KB
MyArrayList.java 4KB
CalendTest01.java 4KB
P1Gson解析.java 4KB
p2随机读写文件了解与使用2.java 4KB
P4Callable下载网络资源并返回结果.java 4KB
Map的常用方法.java 4KB
Properties了解与使用.java 4KB
JSON.java 4KB
数据流的了解与使用.java 4KB
SynchronizerInDepth.java 4KB
P2半双工通信.java 4KB
P4定时任务线程池.java 4KB
LinkedListQueue.java 4KB
P3Test.java 4KB
Flower.java 3KB
P1使用反射调用方法.java 3KB
P2原生Json的了解与使用.java 3KB
P1单工通信.java 3KB
DoubleLoopTest01.java 3KB
checkClassCastException.java 3KB
P1BlockingQueue阻塞队列的应用与了解.java 3KB
p1创建线程Thread.java 3KB
ArrayQueue.java 3KB
ConvertBtoTen.java 3KB
JSON2.java 3KB
File文件操作.java 3KB
Clerk.java 3KB
CheckPrime.java 3KB
SocketUtils.java 3KB
拷贝多层次的文件夹和子文件.java 3KB
双色球练习3.java 3KB
ITPeople.java 3KB
TreeSet了解与使用.java 3KB
Map集合的遍历方式.java 3KB
Java字符串的编码和解码.java 3KB
重载方法.java 3KB
str转Date转Calendar.java 3KB
JDK7自动关闭资源.java 3KB
递归得二分查找法.java 3KB
转换流.java 3KB
ThreadLocal的了解与使用.java 3KB
p1使用clone来克隆对象.java 3KB
判断1到100之间的素数.java 3KB
System工具类.java 3KB
HashSet了解与使用.java 3KB
插入元素到数组.java 3KB
P2使用构造器签名创建创建对象.java 3KB
P1了解线程池机制.java 3KB
数组的反转.java 3KB
GameBall.java 3KB
Clerk.java 3KB
迭代器使用.java 3KB
P1socket了解与应用.java 3KB
获取数组的最大值与最小值.java 3KB
P2Class常用的方法.java 3KB
P2获取Class指定的Method签名信息.java 3KB
SwitchTest01.java 2KB
交换整数数组元素.java 2KB
p1设置线程的优先级.java 2KB
CheckGrade.java 2KB
DoubleLoopTest05.java 2KB
LinkedStack.java 2KB
共 545 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
哆啦哆啦S梦
- 粉丝: 138
- 资源: 517
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功