单选题

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

A. 将构造一个Student对象
B. 表达式是合法的
C. 表达式是错误的
D. 编译时正确,但运行时错误

查看答案
该试题由用户613****94提供 查看答案人数:44234 如遇到问题请 联系客服
正确答案
该试题由用户613****94提供 查看答案人数:44235 如遇到问题请联系客服

相关试题

换一换
单选题
类Teacher和Student是类Person的子类;Person p; Teacher t; Student s; //p, t and s are all non-null. if(t instanceof Person) { s = (Student)t; }最后一句语句的结果是()。
A.将构造一个Student对象 B.表达式是合法的 C.表达式是错误的 D.编译时正确,但运行时错误
答案
单选题
类Teacher和Student是类Person的子类;Person p;Teacher t;Student s; //p, t and s are all non-null.if(){ s =()t; }最后一句语句的结果是()
A.将构造一个Student对象; B.表达式是合法的; C.表达式是错误的; D.编译时正确,但运行时错误。
答案
单选题
设有下面两个类的定义:class Person{long id; String name;} class Student extends Person{int score; int getScore(){return score;}} 则类 Person 和类 Student 的关系是()。
A.继承关系 B.无关系 C.包含关系 D.关联关系
答案
单选题
设有下面两个类的定义:  class Person  long id;// 身份证号  String name://姓名    class Student extends Person  int score://成绩  int getScore( )  return score;       则类Person和类Student的关系是( )。
A.包含关系 B.继承关系 C.关联关系 D.无关系
答案
主观题
已知stu是Student类对象,则执行“print(stu)”时会自动执行Student类的方法
答案
单选题
设有下列两个类的定义,则类Person和类Man的关系是()。 class Person {long id;/ / 身份证号String name;/ / 姓名}class Man extends Person {int age;/ / 年龄int getScore() { return score;}}
A.-3 3 B.5 -9 C.3 -3 D.-6 5
答案
单选题
假设己经定义好了一个类student,现在要定义类derived,它是从student私有派生的,定义类derived的正确写法是()。
A.class derived::student private{//……} B.class derived::student public{//……} C.class derived::private student{//……} D.class derived::public student{//……}
答案
单选题
已知Student类是一个空类,则通过“Student.name=‘unknown’”语句增加的属性可以通过()访问。
A.类名或对象名 B.仅类名 C.仅对象名 D.无法访问
答案
单选题
已知Student类是一个空类,stu1和stu2是Student类的两个对象,则通过“stu1.name=‘李晓明’”语句增加的属性可以通过()访问。
A.Student B.Student C.stu1 D.stu1
答案
单选题
已知Student类有一个类属性__id,stu是Student类的对象,则利用stu访问__id属性的正确方法是()。
A.stu B.stu C.stu D.stu
答案
热门试题
Every student and every teacher _____. 以下哪个是Student类创建对象的正确语句() 通过Person类创建对象p的代码是__ The student could not _____ what the teacher was trying to explain() () interesting person our English teacher is! 在类Acoount中,正确引入类school.Student的语句是哪一项?() The teacher suggested that each student a plan for the vacation. What is the dominant teacher-student relationship in China() If a student pronounces a word wrongly, teacher should______() The teacher asked the new student () class he was in. 假设student类定义了Name,ClassInfor,StuNumber,利用对象初始化器student类的一个对象并初始化它的属性,下面写法正确的是( ) When a teacher sees to it that every student has the equal access to lockstepactivities in class, the teacher is playing the role of a(n)_______. The teacher is strict _____every student and _____everything he does. [ ] The teacher is strict _____ every student and _____ everything he does. [ ] The student is _________ see the teacher because he_________a mistake. Your teacher is the person who teaches you. 以下的SQL语句,Student与Person之间的关系是(  )。CREATE TYPE Person(name char(20),address varchar(50));CREATE TYPE Student(under Person(degree char(20)department char(20)); When a teacher sees to it that every student has the equal access to lockstep activities in class, the teacher is playing the role of a(n)_______. The student’s behavior cost the teacher a steepless night He never thought his student ______ computer games for a whole class The student’s behavior cost the teacher asteepless night . He never thought his student ______ computer games for awhole class .
购买搜题卡 会员须知 | 联系客服
会员须知 | 联系客服
关注公众号,回复验证码
享30次免费查看答案
微信扫码关注 立即领取
恭喜获得奖励,快去免费查看答案吧~
去查看答案
全站题库适用,可用于E考试网网站及系列App

    只用于搜题看答案,不支持试卷、题库练习 ,下载APP还可体验拍照搜题和语音搜索

    支付方式

     

     

     
    首次登录享
    免费查看答案20
    微信扫码登录 账号登录 短信登录
    使用微信扫一扫登录
    登录成功
    首次登录已为您完成账号注册,
    可在【个人中心】修改密码或在登录时选择忘记密码
    账号登录默认密码:手机号后六位