分数: 1
请问以下哪些有关编译器提供的默认无参构造器的描述是正确的?
选择一个答案
 
A. 由编译器决定
 
B. 均是public构造器
 
C. 均与所属类的访问修饰符一致
 
D. 均无访问修饰符
Question2
分数: 1
请问, System.out.println() 方法可以以任何对象做为参数?
选择一个答案
 
a. 否
 
b. 是
Question3
分数: 1
请问以下叙述是否正确:内部类又名嵌套类,是指定义在一个类内部的类,内部类所在的类为外部类,根据内部类在外部类中所处的位置,分为定义在方法体内的内部类和定义在方法体外的成员内部类两种。定义在方法体内的内部类又可分为两种,一种为有实例名称的内部类,另一种为无实例名称的匿名内部类。
选择一个答案
 
a. 是
 
b. 否
Question4
分数: 1
请问以下哪些有关构造器的描述是错误的?
选择一个答案
 
a. 构造器的无返回类型均为void
 
b. 构造器可以抛出异常
 
c. 如果没有提供任何构造器,编译器自动为类提供一个无参的默认构造器
 
d. 子类可以继承父类的构造器
Question5
分数: 1
请问以下哪些修饰符可以用于构造器前?
选择一个答案
 
a. native
 
b. final
 
c. static
 
d. synchronized
 
e. 以上选项均不行
Question6
分数: 1
给出以下代码,请问以下哪些有关重载该方法的描述是正确的?
void method ( int x ) { }
选择至少一个答案
 
a. 重载的方法可以被private修饰符修饰
 
b. 重载的方法必须采用int型作为唯一的一个参数
 
c. 重载的方法必须返回类型为void
 
d. 重载的方法可以返回任意类型的值。
Question7
分数: 1
请问以下哪些是有关方法重载的正确描述?
选择至少一个答案
 
a. 重载的方法不能抛出被重载的方法不能抛出的异常。
 
b. 重载的方法不能被private修饰符修饰。
 
c. 重载的方法和被重载的方法必须具有相同的方法名,参数列表和返回类型。
 
d. 重载的方法访问权限声明不能比被重载的方法的访问范围大。
Question8
分数: 1
给出以下代码,请问该程序的运行结果是什么?
Class S1{
public static void main( String [] args){
new S2();
}
S1(){
System.out.print(“S1”);
}
}
Class S2 extends S1{
S2(){
System.out.print(“S2”);
}
}
选择一个答案
 
a. S1
 
b. S1S2
 
c. S2S1
 
d. S2
Question9
分数: 1
考虑以下类:
1 class Test {
2 void test(int i) {
3 System.out.println( “ I am an int. ” );
4 }
5 void test(String s) {
6 System.out.println( “ I am a string. ” );
7 }
8 public static void main(String args[]) {
9 Test t=new Test();
10 char ch= ' y' ;
11 t.test(ch);
12 }
13 }
有关该类,下面说法正确的是:
选择一个答案
 
a. 第11行会编译失败,因为test()方法没有定义接受char类型的参数;
 
b. 代码编译成功,并且会包含如下输出:I am an int
 
c. 代码会编译成功,但是运行时在11行有异常抛出;
 
d. 第5行会编译失败,因为void方法不能被覆盖;
Question10
分数: 1
给出以下代码 , 请问该程序的运行结果是什么?
class Example{
public static void main(String args[]){
public class In{
public void method(){
System.out.printIn(“inside In”);
}
}
System.out.printIn(“inside Example “ ) ;
}
}
选择一个答案
 
a. 运行抛出异常
 
b. 代码编译失败
 
c. 打印输出inside In
 
d. 打印输出inside Example
Question11
分数: 1
. 请问,是否可以将继承的方法声明为抽象方法?
选择一个答案
 
a. 否
 
b. 是
Question12
分数: 1
给出以下代码,请问该程序编译运行后的结果是什么?( )
public class Example{
public static void main (String args[ ]){
if(true){
Example t=new example();
System.out.println(“Success”);
}
System.out.println(“The end”);
}
}
选择一个答案
 
a. 无内容输出
 
b. 程序进入死循环无法结束
 
c. 打印输出Success
 
d. 代码编译失败
 
e. 运行期抛出异常
Question13
分数: 1
请问以下哪些是类 Example 的有效构造器?
选择至少一个答案
 
a. public static Example { } 
b. public Example { } 
c. final Example(){ }
 
d. private Example { } 
e. public void example { }Question14
分数: 1
在Java中,当在类中定义两个或更多方法,它们有相同的名称而参数项不同时,这称为
选择一个答案
 
A. 多态性
 
B. 继承
 
C. 方法重载
 
D. 方法重写
Question15
分数: 1
给出以下代码,请问该程序编译的结果是什么?
Class A{
Int A=0;
A(int w){
X=w;
}
}
Class B extends A{
Int x=0;
B(int w){
x=w+1;
}
}
选择一个答案
 
a. 代码编译失败,因为类A没有默认的无参构造器
 
b. 代码编译失败,因为类A和类B都没有有效的构造器。
 
c. 代码编译成功
Question16
分数: 1
给出以下代码,该方法为基类中的一个方法。 void method() { } 请问以下哪些是子类中重载该方法的正确形式?
选择一个答案
 
a. void method(int i){ }
 
b. private void method(){ }
 
c. int method(){return 0;}
 
d. public void method(){}
Question17
分数: 1
请问一个类的构造器是否没有返回值类型?
选择一个答案
 
a. 否
 
b. 是
Question18
分数: 1
给出以下代码,请问插入以下哪些语句可以满足对插入语句的要求。
Public class T{
Int r;
Int s;
T(int x,int y){
r=x;
s=y;
}
}
Class S extends T{
Int t;
Pubic S(int x,int y,int z){
// 插入代码处
// 要求插入代码实现 r=x,s=y,t=z;
}
}
选择一个答案
 
a. super(x,y,z);
 
b. this(x,y);
 
c. 以上均不对
 
d. super(x,y);
 
e. T(x,y);