• Object


    一、源码

    public final native Class<?> getClass();

    获得运行时的类

    public native int hashCode();
    

    获得hash码

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

    判断对象是否相等

    protected native Object clone() throws CloneNotSupportedException;
    

    克隆

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

    字符串形式

    public final native void notify();
    public final native void notifyAll();
    

    唤醒监视该对象的一个或多个线程

    public final native void wait(long timeout) throws InterruptedException;
    public final void wait(long timeout, int nanos) throws InterruptedException {
        if (timeout < 0) {
            throw new IllegalArgumentException("timeout value is negative");
        }
    
        if (nanos < 0 || nanos > 999999) {
            throw new IllegalArgumentException(
                                "nanosecond timeout value out of range");
        }
    
        if (nanos > 0) {
            timeout++;
        }
    
        wait(timeout);
    }
    public final void wait() throws InterruptedException {
        wait(0);
    }
    

    使当前线程等待

    protected void finalize() throws Throwable { }
    

    垃圾回收器调用回收对象

  • 相关阅读:
    Ubuntu 杂音 alsa*
    安装YouCompleteMe
    vimrc
    Linux Windows 修改键盘映射
    VMware Workstation+Linux+Xshell+Xftp+MySQL+SQLyog 配置
    leetcode Merge Intervals
    leetcode Remove Duplicates from Sorted Array II
    用栈实现二叉树的非递归中序遍历
    nth_element 测试程序
    Windows 程序设计
  • 原文地址:https://www.cnblogs.com/ctxsdhy/p/12241845.html
Copyright © 2020-2023  润新知