当前位置:网站首页>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 .
边栏推荐
- B_QuRT_User_Guide(36)
- PCI-Express接口的PCB布线规则
- Ros2 topic (03): the difference between ros1 and ros2 [02]
- Caip2021 preliminary VP
- 欢聚时代一面
- 1. Sum of two numbers
- SRM supplier cloud collaborative management platform solution for building materials industry to realize business application scalability and configuration
- USB (XVI) 2022-04-28
- 高效的S2B2C电商系统,是这样帮助电子材料企业提升应变能力的
- FPGA basics catalog
猜你喜欢

Three questions TDM

Mysql索引优化实战一

New potential energy of industrial integration, Xiamen station of city chain technology digital summit successfully held

家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化

Unity3D学习笔记6——GPU实例化(1)

LeeCode -- 6. Zigzag transformation
![Ros2 topic (03): the difference between ros1 and ros2 [01]](/img/20/39d47c93400050a7bc8ad7efea51b3.png)
Ros2 topic (03): the difference between ros1 and ros2 [01]

Cloud native is devouring everything. How should developers deal with it?

海内外技术人们“看”音视频技术的未来

PCB wiring rules of PCI Express interface
随机推荐
B_QuRT_User_Guide(36)
HDU 4747 mex "recommended collection"
家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化
Experience sharing of system architecture designers in preparing for the exam: the direction of paper writing
Digital procurement management system for fresh food industry: help fresh food enterprises solve procurement problems and implement online procurement throughout the process
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."
Mysql索引优化实战二
Unity3d Learning Notes 6 - GPU instantiation (1)
FreeLink开源呼叫中心设计思想
2021icpc Shanghai h.life is a game Kruskal reconstruction tree
LeeCode -- 6. Z 字形变换
System design overview
ROS2专题(03):ROS1和ROS2的区别【02】
Install Fedora under RedHat
Adrnoid Development Series (XXV): create various types of dialog boxes using alertdialog
USB(十五)2022-04-14
USB (十七)2022-04-15
电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级
Dynamics 365 find field filtering
UE4_UE5全景相机