当前位置:网站首页>Summary of common methods of object class (September 14, 2020)
Summary of common methods of object class (September 14, 2020)
2022-07-07 23:29:00 【codepig16】
1.clone()
Protection method , Implement shallow copy of objects ..
Only realized Cloneable Interface , To call this method ,
Otherwise throw CloneNotSupportedException abnormal .
2.getClass()
final Method
Get runtime type .
3.finalize()
Release resources .
It is uncertain when this method will be called .
4.toString()
In general, subclasses have coverage .
5.equals()
In general, subclasses have coverage .
stay Object in ,equals and == It's the same .
6.hashCode()
For hash lookup , You can reduce the use of equals The number of times .
rewrite equals() It's usually rewritten hashCode().
equals identical ,hashCode() Same value .
hashCode Equality is not necessarily satisfied equals.
7.wait()
wait The method is to make the current thread wait for the lock of the object ,
The current thread must be the owner of the object , That is, the lock with the object .
wait() Method has been waiting for , Until the lock is obtained or interrupted .
wait(long timeout) Set a timeout interval , If the lock is not obtained within the specified time, return .
After calling this method, the current thread goes to sleep , Until .
(1) Other threads called the object's notify Method .
(2) Other threads called the object's notifyAll Method .
(3) Other threads called interrupt Interrupt the thread .
(4) Time's up .
At this point, the thread can be scheduled , If it is interrupted, throw a InterruptedException abnormal .
8.notify()
The method wakes up on the object , A thread waiting .
9.notifyAll()
The method wakes up on the object , All threads waiting .
边栏推荐
猜你喜欢

Oracle database backup and recovery

高效的S2B2C电商系统,是这样帮助电子材料企业提升应变能力的

2021icpc Shanghai h.life is a game Kruskal reconstruction tree

Three questions TDM

移动端异构运算技术 - GPU OpenCL 编程(基础篇)
![Given an array, such as [7864, 284, 347, 7732, 8498], now you need to splice the numbers in the array to return the](/img/21/2e99dd6173ab4925ec22290cd4a357.png)
Given an array, such as [7864, 284, 347, 7732, 8498], now you need to splice the numbers in the array to return the "largest possible number."

leetcode-520. Detect capital letters -js

Adults have only one main job, but they have to pay a price. I was persuaded to step back by personnel, and I cried all night

Oracle-数据库的备份与恢复

SRM supplier cloud collaborative management platform solution for building materials industry to realize business application scalability and configuration
随机推荐
城联优品作为新力量初注入,相关上市公司股价应声上涨150%
POJ2392 SpaceElevator [DP]
MySQL Index Optimization Practice I
The text editor of markdown class should add colors to fonts (including typora, CSDN, etc.)
B_QuRT_User_Guide(39)
V-for traversal object
Have all the fresh students of 2022 found jobs? Is it OK to be we media?
2022注册测绘师备考开始 还在不知所措?手把手教你怎么考?
USB(十四)2022-04-12
Three questions TDM
Install a new version of idea. Double click it to open it
As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response
深入理解Mysql锁与事务隔离级别
LM12丨Rolling Heikin Ashi二重K线滤波器
CXF call reports an error. Could not find conduct initiator for address:
系统设计概述
海内外技术人们“看”音视频技术的未来
ROS2专题(03):ROS1和ROS2的区别【02】
Archlinux install MySQL
Unity3d learning notes 5 - create sub mesh