判断一个对象是否是指定类型的实例
复制代码
1
2
3
4
5
6Student stu1=new Student(); Student stu2=new Student(); Teacher tec1=new Teacher(); Teacher tec2=new Teacher(); sout(stu1 instanceof Student) // true sout(tec1 instanceof Student) // error
最后
以上就是碧蓝西装最近收集整理的关于instanceof的全部内容,更多相关instanceof内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复