当前位置:网站首页>[interview question] the difference between instancof and getclass()
[interview question] the difference between instancof and getclass()
2022-06-25 00:03:00 【Juzijun who doesn't want to sleep】
I've been learning about 《Effective Java》 Mentioned in eques When the method is limited , There is talk about igetClass() Can replace nstanceof To determine whether it is the same subclass . So I learned the difference between the two .
To put it simply , The difference is , It is also used to judge whether the subclass and the parent class are equal , Subclass instanceof Parent class by true
Subclass .getClass() == Parent class .getClass() by false.
Because of this simple difference , In the implementation of subclasses equals() When the method is used , Pay more attention to
边栏推荐
- Color gradient gradient color collection
- I suddenly find that the request dependent package in NPM has been discarded. What should I do?
- Sword finger offer merges two sorted lists
- Analysis report on operation mode and future development of global and Chinese methyl cyclopentanoate industry from 2022 to 2028
- openGauss内核:简单查询的执行
- Tutorial details | how to edit and set the navigation function in the coolman system?
- Window系统安装Nacos
- Hello C (VI) -- pointer and string
- Using ADC to control brushless motor source program STM32 library function
- DO280OpenShift访问控制--加密和ConfigMap
猜你喜欢
Eye gaze estimation using webcam
Svg line animation background JS effect
U.S. House of Representatives: digital dollar will support the U.S. dollar as the global reserve currency
Tape SVG animation JS effect
为什么越来越多的实体商铺用VR全景?优势有哪些?
人体改造 VS 数字化身
Why do more and more physical stores use VR panorama? What are the advantages?
Hello C (III) - pointer
水库大坝安全监测
Human body transformation vs digital Avatar
随机推荐
Zed acquisition
机器学习自学成才的十条戒律
人体改造 VS 数字化身
VR全景怎么赚钱?结合市场从两个方面客观分析下
canvas线条的动态效果
How to use stm32subeide SWV function
C程序设计专题 15-16年期末考试习题解答(上)
Reservoir dam safety monitoring
QT cannot be edited with UTF-8
Start QT program
Analysis report on operation trend and investment strategy of global and Chinese tetrahydrofurfuryl propionate industry from 2022 to 2028
Signal integrity (SI) power integrity (PI) learning notes (XXV) differential pair and differential impedance (V)
JPA learning 2 - core annotation, annotation addition, deletion, modification and query, list query result return type, one to many, many to one, many to many
从数字化过渡到智能制造
Why do more and more physical stores use VR panorama? What are the advantages?
Stm32f030f4 reading infrared remote control data
Modify stm32f030 clock source to internal crystal oscillator (HEI)
On the difficulty of developing large im instant messaging system
Today's sleep quality record 79 points
Window系统安装Nacos