java关键字instanceof
时间: 2023-10-19 15:35:29 浏览: 109
Java关键字instanceof用于判断一个对象是否是一个类的实例或者是一个类的子类的实例。它是一个在运行时判断对象类型的运算符。通过使用instanceof关键字,可以判断一个对象是否是某个类的实例,并返回一个布尔值。语法格式如下所示:boolean result = object instanceof Class。其中,object是要判断的对象,Class是要判断的类名。如果object是Class的实例或者是Class的子类的实例,则result为true,否则为false。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [1.10 instanceof关键字](https://blog.csdn.net/weixin_44234912/article/details/108779625)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [Java instanceof 关键字](https://blog.csdn.net/hj1993/article/details/131525186)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [Java关键字instanceof用法及实现策略](https://download.csdn.net/download/weixin_38621553/12721904)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文