当前位置:网站首页>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 .
边栏推荐
- Talk about the design and implementation logic of payment process
- 漏洞复现----49、Apache Airflow 身份验证绕过 (CVE-2020-17526)
- Unity3d learning notes 4 - create mesh advanced interface
- 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
- The text editor of markdown class should add colors to fonts (including typora, CSDN, etc.)
- LeeCode -- 6. Z 字形变换
- Install a new version of idea. Double click it to open it
- Home appliance industry channel business collaboration system solution: help home appliance enterprises quickly realize the Internet of channels
- Add data analysis tools in Excel
- Conversion between commonsmultipartfile and file
猜你喜欢

Matlab-SEIR传染病模型预测

S2b2b mall solution of intelligent supply chain in packaging industry: opening up a new ecosystem of e-commerce consumption
![Ros2 topic (03): the difference between ros1 and ros2 [02]](/img/12/244ea30b5b141a0f47a54c08f4fe9f.png)
Ros2 topic (03): the difference between ros1 and ros2 [02]

B_ QuRT_ User_ Guide(36)

七月第一周

Inftnews | web5 vs Web3: the future is a process, not a destination

Oracle database backup and recovery

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

包装行业智能供应链S2B2B商城解决方案:开辟电商消费新生态

re1攻防世界逆向
随机推荐
Mysql索引优化实战一
Talk about the design and implementation logic of payment process
2022第六季完美童模陕西总决赛圆满落幕
PCI-Express接口的PCB布线规则
Explain
re1攻防世界逆向
HDU 4747 Mex「建议收藏」
Technology at home and abroad people "see" the future of audio and video technology
V-for traversal object
三问TDM
FPGA basics catalog
USB (XV) 2022-04-14
Inftnews | web5 vs Web3: the future is a process, not a destination
家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化
Entity层、DAO层、Service层、Controller层 先后顺序
USB(十六)2022-04-28
In the field of software engineering, we have been doing scientific research for ten years!
STL标准模板库(Standard Template Library)一周学习总结
PHP uses Alibaba cloud storage
Digital procurement management system for fresh food industry: help fresh food enterprises solve procurement problems and implement online procurement throughout the process