stem.out.println(b);
}
A
、true
B、false
C、1
D、0
A B C D
17.给出下列代码片段:
if(x>0){System.out.println("first");}
else if(x>-3){ System.out.println("second");}
else {System.out.println("third");}
请问x处于
什么范围时将
打印字符串“second”?
A、x>0
B、x>-3
C、x<=-3
D、x<=0 &; x>-3
A B C D
18.以下程序的功能是:求n!。请在下列程序中填入
正确的语句
class FactorialTest{
static long Factorial(int n){
if(n==1)
return 1;
else
_______________}
public static void main(String a[]){
int n=8;
System.out.println(n+"!="+Factorial(n));}
}
A、return n*Factorial(n);
B、return (n-1)*Factorial(n);
C、return n*Factorial(n-1);
D、return (n-1)*Factorial(n-1);
A B C D
19.若要把变量声名为暂时性变量,应使用如下哪种修饰符?
A、protected
B、provate
C、transient
D、volatile
A B C D
20.Java
语言中,能完成资源释放功能的是____。
A、free
B、finalize
C、final
D、throw
A B C D
21.在Java中,一个类可同时
定义许多同名的方法,这些方法的形式参数的个数、
类型 或顺序各不相同,传回的值也
可以不相同,这种
面向对象程序特性称为
A、隐藏
B、覆盖
C、重载
D、Java不支持此
特性 A B C D
22.在使用interface声明一个接口时,只可以使用____修饰符修饰该
接口。
A、private
B、protected
C、private protected
D、public
A B C D
23.下列代码的输出结果是
class Parent
{
void printMe()
{
System.out.println("parent");
}
}
class Child extends Parent
{
void printMe()
{
System.out.println("child");
}
void printall()
{
super.printMe();
this.printMe();
printMe();
}
}
public class Test_this
{
public static void main(String args[])
{
Child myC=new Child();
myC.printall();
}
}
A、parent
child
child
B、parent
child
parent
C、parent
child
D、
编译错误 A B C D
24.在编写Java application程序时,若
需要使用到标准输入输出语句,
必须在程序
的开头
写上____语句。
A、import java.awt.*;
B、import java.applet.applet;
C、import java.io.*;
D、import java.awt.Graphics;
A B C D
25.如要抛出异常,应用下列哪种子句?
A、catch
B、throw
C、try
D、finally
A B