当前位置:网站首页>[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
边栏推荐
- Window system installation Nacos
- Analysis report on operation pattern and supply and demand situation of global and Chinese cyano ketoprofen industry from 2022 to 2028
- Hello C (VI) -- pointer and string
- Hello C (V) -- pointer and array
- 水库大坝安全监测
- 抖音實戰~項目關聯UniCloud
- Scala IO case
- 离散数学及其应用 2018-2019学年春夏学期期末考试 习题详解
- 【Proteus仿真】定时器0作为16位计数器使用示例
- Tape SVG animation JS effect
猜你喜欢

Dynamic effect of canvas lines

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

Eye gaze estimation using webcam

One way 和two way ANOVA分析的区别是啥,以及如何使用SPSS或者prism进行统计分析

How to use stm32subeide SWV function

Mirror image of sword finger offer binary tree

What are the advantages of VR panoramic production? Why is it favored?

Scala IO reads binary files

水库大坝安全监测

Collective example
随机推荐
Im instant messaging development application keeping alive process anti kill
Fast pace? high pressure? VR panoramic Inn brings you a comfortable life
Overview of medium and low speed aerospace electronic bus
磁带svg动画js特效
Analysis report on the development trend and Prospect of cetamide industry in the world and China from 2022 to 2028
QT display RGB data
中低速航空航天电子总线概述
C程序设计专题 15-16年期末考试习题解答(上)
浅析大型IM即时通讯系统开发难度
离散数学及其应用 2018-2019学年春夏学期期末考试 习题详解
JPA learning 1 - overview, JPA, JPA core annotations, JPA core objects
The living standards of ordinary people
linux 系统redis常用命令
Current situation and development prospect forecast report of global and Chinese tetrahydrofurfuryl alcohol acetate industry from 2022 to 2028
干接点和湿接点
【面试题】什么是事务,什么是脏读、不可重复读、幻读,以及MySQL的几种事务隔离级别的应对方法
Sword finger offer merges two sorted lists
走近Harvest Moon:Moonbeam DeFi狂欢会
从数字化过渡到智能制造
Nominal resistance table of patch resistors with 5% and 1% accuracy