当前位置:网站首页>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 .
边栏推荐
- 1. Sum of two numbers
- sql 数据库执行问题
- The efficient s2b2c e-commerce system helps electronic material enterprises improve their adaptability in this way
- [compilation principle] lexical analysis design and Implementation
- 漏洞复现----49、Apache Airflow 身份验证绕过 (CVE-2020-17526)
- 高效的S2B2C电商系统,是这样帮助电子材料企业提升应变能力的
- POJ2392 SpaceElevator [DP]
- 云原生数据仓库AnalyticDB MySQL版用户手册
- UE4_UE5全景相机
- 2022 Season 6 perfect children's model Shaanxi finals came to a successful conclusion
猜你喜欢
七月第一周
MATLAB signal processing [Q & A essays · 2]
In the field of software engineering, we have been doing scientific research for ten years!
One week learning summary of STL Standard Template Library
Unity3d Learning Notes 6 - GPU instantiation (1)
家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化
ROS2专题(03):ROS1和ROS2的区别【01】
USB (XV) 2022-04-14
Talk about the design and implementation logic of payment process
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
随机推荐
LDO voltage stabilizing chip - internal block diagram and selection parameters
Home appliance industry channel business collaboration system solution: help home appliance enterprises quickly realize the Internet of channels
HDU 4747 mex "recommended collection"
S2b2b mall solution of intelligent supply chain in packaging industry: opening up a new ecosystem of e-commerce consumption
js 获取对象的key和value
New potential energy of industrial integration, Xiamen station of city chain technology digital summit successfully held
ROS2专题(03):ROS1和ROS2的区别【01】
云原生数据仓库AnalyticDB MySQL版用户手册
Matlab SEIR infectious disease model prediction
欢聚时代一面
进度播报|广州地铁七号线全线29台盾构机全部完成始发
Live-Server使用
违法行为分析1
2022 Season 6 perfect children's model Shaanxi finals came to a successful conclusion
The 19th Zhejiang Provincial Collegiate Programming Contest VP记录+补题
Caip2021 preliminary VP
RE1 attack and defense world reverse
Cloud native is devouring everything. How should developers deal with it?
深入理解Mysql锁与事务隔离级别
v-for遍历对象