给出类的定义如下: 1. class Test{ void test(); } } 下列描述哪个正确?
A.程序将不会编译,因为空的方法不能被覆盖。
B.命令行t.test; 将不会编译,因为没有对应的方法。
C.代码将编译并输出以下结果: I am an int.
D.代码将编译并输出以下结果: I am a string.
A.程序将不会编译,因为空的方法不能被覆盖。
B.命令行t.test; 将不会编译,因为没有对应的方法。
C.代码将编译并输出以下结果: I am an int.
D.代码将编译并输出以下结果: I am a string.
第1题
阅读下面程序 class Test implements Runnable { public static void main(String[] args) { Test t = new Test(); t.startO; } public void run(){ } } 下列关于上述程序的叙述正确的是
A.程序不能通过编译,因为start()方法在Test类中没有定义
B.程序编译通过,但运行时出错,提示start()方法没有定义
C.程序不能通过编译,因为run()方法没有定义方法体
D.程序编译通过,且运行正常
第2题
A.编译指示带有final 方法的类自己必须定义为final
B.编译指示不能继承含有final 方法的类
C.运行错误,原因是Base类没有定义为final类
D.运行输出 amethod
第4题
A.①②皆无编译错误
B.①有编译错误,②无编译错误
C.①无编译错误,②有编译错误
D.①②皆有编译错误
第5题
A:abstractfinalclassHI{}(final代表常量,但是抽象类不能实例化)
B:abstractprivatemove(){}(这是定义方法的)
C:protectedprivatenumber;(不是定义类,且修饰符重复)
D:publicabstractclassCar{}
第7题
有如下程序:
class Base{
public:
int data;
};
class Derived1:public Base{};
class Derived2:protected Base{};
int main(){
Derived1 d1;
Derived2 d2;
d1. data=0; //①
d2. data=0; //②
return 0;
}
下列关于程序编译结果的描述中,正确的是()。
A) ①②皆无编译错误
B) ①有编译错误,②无编译错误
C) ①无编译错误,②有编译错误
D) ①②皆有编译错误
第8题
A.①②皆无编译错误
B.①有编译错误,②无编译错误
C.①无编译错误,②有编译错误
D.①②皆有编译错误
第9题
关于异常的含义,下列描述中最正确的一个是()。
A.程序编译错误
B.程序语法错误
C.程序自定义的异常事件
D.程序编译或者运行时发生的异常事件
第10题
A.System类是final关键字修饰的类,它不能被其他类所继承
B.System类不能被实例化
C.System类中定义了许多方法,但是没有定义属性
D.System类中提供了获取当前系统属性的方法