Sunday, 9 August 2015

Object class

public class Object
{

    public Object()
    {
    }

    private static native void registerNatives();

    public final native Class getClass();

    public native int hashCode();

    public boolean equals(Object obj)
    {
        return this == obj;
    }

    protected native Object clone()
        throws CloneNotSupportedException;

    public String toString()
    {
        return (new StringBuilder()).append(getClass().getName()).append("@").append(Integer.toHexString(hashCode())).toString();
    }

    public final native void notify();

    public final native void notifyAll();

    public final native void wait(long l)
        throws InterruptedException;

    public final void wait(long l, int i)
        throws InterruptedException
    {
        if(l < 0L)
            throw new IllegalArgumentException("timeout value is negative");
        if(i < 0 || i > 999999)
            throw new IllegalArgumentException("nanosecond timeout value out of range");
        if(i >= 500000 || i != 0 && l == 0L)
            l++;
        wait(l);
    }

    public final void wait()
        throws InterruptedException
    {
        wait(0L);
    }

    protected void finalize()
        throws Throwable
    {
    }

    static
    {
        registerNatives();
    }
}

No comments:

Post a Comment