instanceof 父类子类

结论:

  • 子类 instanceof 父类 == true
  • 父类 instanceof 子类 == false
public class Test {

 public static void main(String[] args) {
//instanceof 父类子类
Father father1 = new Father();
System.out.println(father1 instanceof Father ); //ture
System.out.println(father1 instanceof Son ); //false Father father2 = new Son();
System.out.println(father2 instanceof Father ); //ture
System.out.println(father2 instanceof Son ); //ture Son son = new Son();
System.out.println(son instanceof Father ); //ture
System.out.println(son instanceof Son ); //ture
}
}

最新文章

  1. jmeter 性能测试工具的使用(Web性能测试)
  2. HTML5学习总结-06 WebWorker
  3. openssl命令用法
  4. EventBus的使用,初学EventBus传值
  5. 在Ubuntu Linux下安装Code::Blocks和Eclipse CDT
  6. OCR识别流程
  7. 【python】二进制、八进制、十六进制表示方法(3.0以上)
  8. Warm up
  9. hdoj 1013
  10. 命令模式(CommandPattern)
  11. 银盒子智慧餐厅硬件尺寸规格&推荐机型
  12. bootstrap3兼容IE8
  13. Python中xlutils解析
  14. 1873: This offer(zzuli)
  15. 【JMeter】接口自动化环境搭建
  16. jquery radio使用
  17. IOS初级:app的图标
  18. maven中的各种问题
  19. 建造者模式及C++实现
  20. 洛谷 P4066 [SHOI2003]吃豆豆 解题报告

热门文章

  1. form编码方式application/x-www-form-urlencoded和multipart/form-data的区别?
  2. 随时更新web html 项目页面,查看手机等其他移动设备的几种方法?
  3. 22-7map
  4. Pregel Aggregator
  5. 前端mockjs模拟图片验证码
  6. Java处理图片工具类
  7. 29. StringBuilder
  8. springmvc之json交互406异常(Not Acceptable)和415异常(Unsupported Media Type)
  9. tesserocr与pytesseract模块的使用
  10. 移动端图片轮播效果:depth模式总结