1.Java语言具有许多优点和特点,下列选项中,哪个反映了Java程序并行机制的特点:
A、安全性
B、多线程
C、跨平台
D、可移值
2.编写和运行Java applet程序与编写和运行Java application程序不同的步骤是
A、编写源代码
B、编写HTML文件调用该小程序,以.html为扩展名存入相同文件夹
C、编译过程
D、解释执行
3.Java的字符类型采用的是Unicode编码方案,每个Unicode码占用____个比特位。
A、8
B、16
C、32
D、64
4.关于下列程序段的输出结果,说法正确的是
public class MyClass{
static int i;
public static void main(String argv[]){
System.out.println(i);
}
}
A、有错误,变量i没有初始化。
B、null
C、1
D、0
5.下列代码的执行结果是:
public class Test3{
public static void main(String args[]){
System.out.print(100%3);
System.out.print(",");
System.out.println(100%3.0);
}
}
A、1,1
B、1,1.0
C、1.0,1
D、1.0,1.0
6.下列程序段的输出结果是
void complicatedExpression(){
int x=20, y=30;
boolean b;
b=x>50&&y>60||x>50&&y<-60||x<-50&&y>60||x<-50&&y<-60;
System.out.println(b);
}
A、true
B、false
C、1
D、0
7.给出下列代码片段:
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
8.以下程序的功能是:求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);
9.若要把变量声名为暂时性变量,应使用如下哪种修饰符?
A、protected
B、provate
C、transient
D、volatile
10.Java语言中,能完成资源释放功能的是____。
A、free
B、finalize
C、final
D、throw