16.下列程序段的输出结果是 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
|
| 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 |