类 Teacher 和 Student 是类 Person 的子类; Teacher t; Student s; // t and s are all non-null. if (t instanceof Person ){ s=(Student)t; } 最后一条语句的结果是:

题目内容(请给出正确答案)

类 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.编译时正确, 但运行时错误。

参考答案和解析
编译时正确,但运行时错误
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
更多相关问题