注意:此页面搜索的是所有试题
国际开放大学Java语言程序设计
下列代码段的运行结果为()
public class Test {
public static void main(String[] args) {
int num = 0x20;
System.out.println("current value:" + num);
}
}
A. current value: 20 B. 编译错误
C. current value: 32 D. current value: num

下列代码执行的运行结果为()
public class Test {
public static void main(String[] args) {
byte num = 147;
System.out.println("byte value:"+ num);
}
}
A byte value: 147 B. 编译错误
C. byte value: 128 D. byte value is 0

下列代码执行的运行结果为()
public class Test {
public static void main(String[] args) {
int num = 170;
System.out.println("int value:" + (num--));
}
}
A. int value: 170 B. 编译错误
A. int value: 169 D. int value: 171

在Java语言中,正确的注释方式是( )。
A. –注释信息 B. ##-- 注释信息
C. /* 注释信息 */ D. #!注释信息

下列代码执行的结果是()
public class Test {
public static void main(String[] args) {
int score = 60;
if (score >= 90) {
System.out.println("The Score is good");
}
else if (score >= 60) {
System.out.println("The Score is OK");
}
else {
System.out.println("The Socre is low");
}
}
}

A. The Score is good B. 编译错误
C. The Score is OK D. The score is low

实现1到100的数字累计加和,下列哪个流程控制语句可以实现:
A. do-while语句 B. if-else语句 C. try-catch语句 D. switch-case语句

在循环语句中,中断一次循环的控制指令是()
A. continue B. switch C. break D. stop

下列哪一种叙述是正确的( )
A. abstract修饰符可修饰字段、方法和类
B. 接口不能继承另外一个接口
C. 抽象类不能继承接口
D. 一个类允许实现多个接口

下列代码的执行结果为: ( )
public class Super {
public Integer getLength() { return new Integer(4); }
}

class Sub extends Super {
public Integer getLength() { return new Integer(5); }
public static void main(String[] args) {
Super superObj = new Super();
Sub subObj = new Sub();
System.out.println(superObj.getLength().toString() + "," +
subObj.getLength().toString() );
}
}
输出是什么?
A. 4,4
B. 4,5
C. 5,4
D. 编译失败.---------重定时不能改变返回类型

下列代码的执行结果是()
class Base {
Base() { System.out.print("Base"); }
}
public class Alpha extends Base {
public Alpha() {
System.out.print("Alpha");
}
public static void main( String[] args ) {
new Alpha();
new Base();
}
}
A. BaseAlpha
B. BaseAlphaBase
C. 编译失败.
D. 代码运行但没有输出.

以下关于异常的说法正确的是()
A. 一旦出现异常,程序运行就终止了  
B. 如果一个方法申明将抛出某个异常,它就必须真的抛出那个异常 
C. 在catch子句中匹配异常是一种精确匹配
D. 可能抛出系统异常的方法是不需要申明异常的

下列代码的执行结果是什么?
public class Foo {
public static void main(String[] args) {
try {
String info = null;
System.out.println(info.toString());
} catch (Exception e) {
System.out.print("info is null;");
}
finally {
System.out.println( "Finally" );
}
}
}
A. info is null;Finally
B. 编译失败
C. 代码正常运行但没有任何输出.
D. 运行时抛出异常


关于包的描述中,正确的说法是()
A. 使用import语句引入包 B. package创建包语句可以在类的任意位置
C. import语句一次只能引入一个唯一包 D. 包必须有明确的包名称

以protected修饰的类如:protected class Car{…} 则Car( )
A、可被其它程序包中的类使用 B、仅能被本程序包中的类使用
C、不能被任意其它类使用 D、不能被其它类继承

下列关于类继承正确的使用方式是(),其中Z1/Z2为接口,X1/X2为类
A. public interface Z1 implements Z2 {…}
B. public class X1 implements X2 {…}
C. public class Z1 extends X1 {…}
D. public class X1 implements Z1 {…}