当前位置:网站首页>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 .
边栏推荐
- 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."
- 电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级
- 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
- Puce à tension stabilisée LDO - schéma de bloc interne et paramètres de sélection du modèle
- VS扩展工具笔记
- PCB wiring rules of PCI Express interface
- 城联优品作为新力量初注入,相关上市公司股价应声上涨150%
- LDO稳压芯片-内部框图及选型参数
- The efficient s2b2c e-commerce system helps electronic material enterprises improve their adaptability in this way
- 2022 届的应届生都找到工作了吗?做自媒体可以吗?
猜你喜欢

B_QuRT_User_Guide(36)

电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级

Live-Server使用

B_QuRT_User_Guide(36)

S2b2b mall solution of intelligent supply chain in packaging industry: opening up a new ecosystem of e-commerce consumption
![MATLAB signal processing [Q & A essays · 2]](/img/be/0baa92767c3abbda9b0bff47cb3a75.png)
MATLAB signal processing [Q & A essays · 2]

js 获取对象的key和value

New potential energy of industrial integration, Xiamen station of city chain technology digital summit successfully held
![[microservices SCG] gateway integration Sentinel](/img/f3/410d7228b4b253ebf41015a785099f.png)
[microservices SCG] gateway integration Sentinel

One week learning summary of STL Standard Template Library
随机推荐
Dynamics 365 find field filtering
How can we make money by making video clips from our media?
The 19th Zhejiang Provincial Collegiate Programming Contest VP记录+补题
leetcode-520. Detect capital letters -js
v-for遍历对象
Solution of intelligent supply chain collaboration platform in electronic equipment industry: solve inefficiency and enable digital upgrading of industry
Entity层、DAO层、Service层、Controller层 先后顺序
移动端异构运算技术 - GPU OpenCL 编程(基础篇)
HDU 4747 Mex「建议收藏」
Happy gathering time
Inftnews | the wide application of NFT technology and its existing problems
LDO穩壓芯片-內部框圖及選型參數
Solve the problem of duplicate request resource paths /o2o/shopadmin/o2o/shopadmin/getproductbyid
Unity3D学习笔记4——创建Mesh高级接口
13、 System optimization
Deep understanding of MySQL lock and transaction isolation level
伸展树(一) - 图文解析与C语言实现
[microservices SCG] gateway integration Sentinel
聊聊支付流程的设计与实现逻辑
In the field of software engineering, we have been doing scientific research for ten years!