⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 object.java

📁 This is a resource based on j2me embedded,if you dont understand,you can connection with me .
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * @(#)Object.java	1.63 06/10/10 * * Copyright  1990-2008 Sun Microsystems, Inc. All Rights Reserved.   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER   *    * This program is free software; you can redistribute it and/or   * modify it under the terms of the GNU General Public License version   * 2 only, as published by the Free Software Foundation.    *    * This program is distributed in the hope that it will be useful, but   * WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   * General Public License version 2 for more details (a copy is   * included at /legal/license.txt).    *    * You should have received a copy of the GNU General Public License   * version 2 along with this work; if not, write to the Free Software   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA   * 02110-1301 USA    *    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa   * Clara, CA 95054 or visit www.sun.com if you need additional   * information or have any questions.  * */package java.lang;/** * Class <code>Object</code> is the root of the class hierarchy.  * Every class has <code>Object</code> as a superclass. All objects,  * including arrays, implement the methods of this class.  * * @author  unascribed * @version 1.55, 05/03/00 * @see     java.lang.Class * @since   JDK1.0 */public class Object {    /* No need to do this if ROMized    private static native void registerNatives();    static {        registerNatives();    }    */    /**     * Returns the runtime class of an object. That <tt>Class</tt>      * object is the object that is locked by <tt>static synchronized</tt>      * methods of the represented class.     *     * @return  the object of type <code>Class</code> that represents the     *          runtime class of the object.     */    public final native Class getClass();    /**     * Returns a hash code value for the object. This method is      * supported for the benefit of hashtables such as those provided by      * <code>java.util.Hashtable</code>.      * <p>     * The general contract of <code>hashCode</code> is:      * <ul>     * <li>Whenever it is invoked on the same object more than once during      *     an execution of a Java application, the <tt>hashCode</tt> method      *     must consistently return the same integer, provided no information      *     used in <tt>equals</tt> 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 <tt>equals(Object)</tt>     *     method, then calling the <code>hashCode</code> 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 <tt>hashCode</tt> 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 hashtables.     * </ul>     * <p>     * As much as is reasonably practical, the hashCode method defined by      * class <tt>Object</tt> 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<font size="-2"><sup>TM</sup></font> programming language.)     *     * @return  a hash code value for this object.     * @see     java.lang.Object#equals(java.lang.Object)     * @see     java.util.Hashtable     */    public native int hashCode();    /**     * Indicates whether some other object is "equal to" this one.     * <p>     * The <code>equals</code> 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>, <code>x.equals(x)</code> should return     *     <code>true</code>.     * <li>It is <i>symmetric</i>: for any non-null reference values     *     <code>x</code> and <code>y</code>, <code>x.equals(y)</code>     *     should return <code>true</code> if and only if     *     <code>y.equals(x)</code> returns <code>true</code>.     * <li>It is <i>transitive</i>: for any non-null reference values     *     <code>x</code>, <code>y</code>, and <code>z</code>, if     *     <code>x.equals(y)</code> returns <code>true</code> and     *     <code>y.equals(z)</code> returns <code>true</code>, then     *     <code>x.equals(z)</code> should return <code>true</code>.     * <li>It is <i>consistent</i>: for any non-null reference values     *     <code>x</code> and <code>y</code>, multiple invocations of     *     <tt>x.equals(y)</tt> consistently return <code>true</code>     *     or consistently return <code>false</code>, provided no     *     information used in <code>equals</code> comparisons on the     *     objects is modified.     * <li>For any non-null reference value <code>x</code>,     *     <code>x.equals(null)</code> should return <code>false</code>.     * </ul>     * <p>     * The <tt>equals</tt> method for class <code>Object</code> implements      * the most discriminating possible equivalence relation on objects;      * that is, for any non-null reference values <code>x</code> and     * <code>y</code>, this method returns <code>true</code> if and only     * if <code>x</code> and <code>y</code> refer to the same object     * (<code>x == y</code> has the value <code>true</code>).     * <p>     * Note that it is generally necessary to override the <tt>hashCode</tt>     * method whenever this method is overridden, so as to maintain the     * general contract for the <tt>hashCode</tt> method, which states     * that equal objects must have equal hash codes.      *     * @param   obj   the reference object with which to compare.     * @return  <code>true</code> if this object is the same as the obj     *          argument; <code>false</code> otherwise.     * @see     #hashCode()     * @see     java.util.Hashtable     */    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 <tt>x</tt>, 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 <tt>true</tt>, but these are not absolute requirements.      * While it is typically the case that:     * <blockquote>     * <pre>     * x.clone().equals(x)</pre></blockquote>     * will be <tt>true</tt>, this is not an absolute requirement.      * <p>     * By convention, the returned object should be obtained by calling     * <tt>super.clone</tt>.  If a class and all of its superclasses (except     * <tt>Object</tt>) obey this convention, it will be the case that     * <tt>x.clone().getClass() == x.getClass()</tt>.     * <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 <tt>super.clone</tt> 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 <tt>super.clone</tt>     * need to be modified.     * <p>     * The method <tt>clone</tt> for class <tt>Object</tt> performs a      * specific cloning operation. First, if the class of this object does      * not implement the interface <tt>Cloneable</tt>, then a      * <tt>CloneNotSupportedException</tt> is thrown. Note that all arrays      * are considered to implement the interface <tt>Cloneable</tt>.      * Otherwise, this method creates a new instance of the class of this      * object and initializes all its fields with exactly the contents of      * the corresponding fields of this object, as if by assignment; the     * contents of the fields are not themselves cloned. Thus, this method      * performs a "shallow copy" of this object, not a "deep copy" operation.     * <p>     * The class <tt>Object</tt> does not itself implement the interface      * <tt>Cloneable</tt>, so calling the <tt>clone</tt> method on an object      * whose class is <tt>Object</tt> will result in throwing an     * exception at run time.     *     * @return     a clone of this instance.     * @exception  CloneNotSupportedException  if the object's class does not     *               support the <code>Cloneable</code> interface. Subclasses     *               that override the <code>clone</code> method can also     *               throw this exception to indicate that an instance cannot     *               be cloned.     * @see java.lang.Cloneable     */    protected native Object clone() throws CloneNotSupportedException;    /**     * Returns a string representation of the object. In general, the      * <code>toString</code> method returns a string that      * "textually represents" this object. The result should      * be a concise but informative representation that is easy for a      * person to read.     * It is recommended that all subclasses override this method.     * <p>     * The <code>toString</code> method for class <code>Object</code>      * returns a string consisting of the name of the class of which the      * object is an instance, the at-sign character `<code>@</code>', and      * the unsigned hexadecimal representation of the hash code of the      * object. In other words, this method returns a string equal to the      * value of:     * <blockquote>     * <pre>     * getClass().getName() + '@' + Integer.toHexString(hashCode())     * </pre></blockquote>     *     * @return  a string representation of the object.     */    public String toString() {	return getClass().getName() + "@" + Integer.toHexString(hashCode());    }    /**     * Wakes up a single thread that is waiting on this object's      * monitor. If any threads are waiting on this object, one of them      * is chosen to be awakened. The choice is arbitrary and occurs at      * the discretion of the implementation. A thread waits on an object's      * monitor by calling one of the <code>wait</code> methods.     * <p>     * The awakened thread will not be able to proceed until the current      * thread relinquishes the lock on this object. The awakened thread will      * compete in the usual manner with any other threads that might be      * actively competing to synchronize on this object; for example, the      * awakened thread enjoys no reliable privilege or disadvantage in being      * the next thread to lock this object.     * <p>     * This method should only be called by a thread that is the owner      * of this object's monitor. A thread becomes the owner of the      * object's monitor in one of three ways:      * <ul>     * <li>By executing a synchronized instance method of that object.      * <li>By executing the body of a <code>synchronized</code> statement      *     that synchronizes on the object.      * <li>For objects of type <code>Class,</code> by executing a 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -