黑马程序员技术交流社区

标题: instance选择题 [打印本页]

作者: 东大小宇哥    时间: 2015-5-19 21:05
标题: instance选择题
类 Teacher 和 Student 是类 Person 的子类;
   Teacher t;
Student s;
// t and s are all non-null.
if (t instanceof Person ){   s=(Student)t; }
最后一条语句的结果是:
A.将构造一个 Student 对象;
B.表达式是合法的;
C.表达式是错误的;
D.编译时正确, 但运行时错误。




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2