Java语言测试(6)

2021-02-21 09:01

本学校计算机系java程序设计教学使用的教案

答:子类可以从父类继承除了构造函数之外的所有函数。当一个类实现一个接口时,它可以定义该接口中的所有方法。A,C正确。

31、 在如下源代码文件Test.java中, 哪个是正确的类定义? A、 public class test { public int x = 0; public test(int x) {

this.x = x; } }

B、public class Test{ public int x=0; public Test(int x) { this.x = x; } }

C、public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }

D、 public class Test extends T1{ public int x=0; public Test(int x){ this.x = x; } }

E、protected class Test extends T2{ public int x=0; public Test(int x){ this.x=x; } }

答:在源代码文件Test.java中,类名必

须是Test, 不是test, 因为Java是大小写敏感的. 一个类不能有多个父类. 约束符protected不能放在类前。B,D正确。

32、 Person, Student 和Teacher 都是类名。这些类有以下继承关系。 Person |

--------------- | |

Student Teacher

并且在Java源代码中有如下表达式: Person p = new Student(); 如下哪个语句是正确的? A、 The expression is legal. B、The expression is illegal.

C、Some errors will occur when compile. D、Compile is correct but it will be wrong when running.

答:父类的指针也可指向子类。A正确。

33、 当Frame改变大小时,放在其中的按钮高度变化,宽度不变,则使用如下哪个layout?

A、 FlowLayout B、CardLayout

C、North and South of BorderLayout D、East and West of BorderLayout E、GridLayout

答:使用BorderLayout 的East和West。D正确。

34、 当Frame改变大小时,放在其中的按钮大小不变,则使用如下哪个layout? A、 FlowLayout B、CardLayout

C、North and South of BorderLayout D、East and West of BorderLayout E、GridLayout


Java语言测试(6).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:高硕教育—会计硕士考研名校解析考试科目+分数线+参考书+相关资

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: