当前位置:网站首页>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 .
边栏推荐
- The 19th Zhejiang Provincial College Programming Contest VP record + supplementary questions
- 系统架构设计师备考经验分享:论文出题方向
- 2022注册测绘师备考开始 还在不知所措?手把手教你怎么考?
- HDU 4747 mex "recommended collection"
- As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response
- LDO稳压芯片-内部框图及选型参数
- Tree background data storage (using webmethod) [easy to understand]
- PCB wiring rules of PCI Express interface
- Unity3d learning notes 4 - create mesh advanced interface
- ROS2专题(03):ROS1和ROS2的区别【02】
猜你喜欢
UE4_ Use of ue5 blueprint command node (turn on / off screen response log publish full screen display)
Matlab SEIR infectious disease model prediction
Unity3d Learning Notes 6 - GPU instantiation (1)
B_QuRT_User_Guide(36)
LDO voltage stabilizing chip - internal block diagram and selection parameters
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锁与事务隔离级别
家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化
Spark 离线开发框架设计与实现
In the field of software engineering, we have been doing scientific research for ten years!
随机推荐
家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化
USB (XV) 2022-04-14
云原生正在吞噬一切,开发者该如何应对?
HDU 4747 Mex「建议收藏」
经纬度PLT文件格式说明
USB (XIV) 2022-04-12
2021icpc Shanghai h.life is a game Kruskal reconstruction tree
As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response
违法行为分析1
Unity3D学习笔记6——GPU实例化(1)
Home appliance industry channel business collaboration system solution: help home appliance enterprises quickly realize the Internet of channels
Install Fedora under RedHat
FPGA基础篇目录
给出一个数组,如 [7864, 284, 347, 7732, 8498],现在需要将数组中的数字拼接起来,返回「最大的可能拼出的数字」
ROS2专题(03):ROS1和ROS2的区别【02】
三问TDM
高级程序员必知必会,一文详解MySQL主从同步原理,推荐收藏
Installing spss25
Explain
SRM supplier cloud collaborative management platform solution for building materials industry to realize business application scalability and configuration