21.下列代表十六进制整数的是( )。
A.0XA6
B.1234L
C.-840
D.0144
22.按运算符的功能划分,运算符”+=”的类型是( )。
A.算术运算符
B.关系运算符
C.逻辑运算符
D.赋值运算符
23.阅读下面代码
if(x= =0){System.OUt.println("冠军");}
elseif(x>-3){System.OUt.println("亚军");)
else{System.Out.println("季军");)
若要求打印字符串”季军”,则变量X的取值范围是( )。
A.x=0&x<= -3
B.x>0
C.x>-3
D.x<=-3
24.下面语句会产生编译错误的是( )。
A.float F=1024.OF;
B.double D=1024.0;
C.byte B=1024;
D.char C=1024;
25.下面程序段的输出结果是( )。
public class Test{
public static void main(String args[]){
int X,y;
x=(int)Math.sqrt(5)/2+(int)Math.random()*5/2;
y=(int)Math.sqrt(3)/2+(int)Math.random()*3/2;
if(x>v)
System.OUt.println("x>y");
elseif(x= =y)
System.out.println("x=Y");
else
System.out.println("x
}
}
A.x>y
B.x=Y
C.x D.编译错误
26.下列Java组件中,不属于容器的是( )。
A.Panel
B.Window
C.Frame
D.Label
27.下列组件不能添加进Frame主窗口的是( )。
A.Panel
B.CheckBox
C.Dialog
D.Choice
28.下面程序段的输出结果是( )。
public class Test(
public static void main(String args[]){
int[]a=new int[113;
int[]p=new int[43;
int k=5:
for(int i=1;i<=10;i++)
a[i]=i;
for(int i=1;i<=3;i++)
p[i]=a[i*i];
for(int i=1;i<=3;i++)
k=k+p[i]*2;
System.out.println(k);
}
}
A.37
B.31
C.33
D.35
29.当一个应用程序的所有非守护线程终止运行时,但仍然有守护线程在运行,应用程序将( )。
A.运行
B.阻塞
C.终止
D.休眠
30.实现下列( )接口可以对TextField对象的事件进行监听和处理。
A.ActionListener
B.FocusListener
C.MouseMotionListener
D.WindowListener