《Java程序设计》课程 试卷1
一、单选题(每题1分,共12分)
:
1) String str = null;
2) if ((str != null) && (() > 10)) {
3) ("more than 10");
4) }
5) else if ((str != null) & (() < 5)) {
6) ("less than 5");
7) }
8) else { ("end");}
哪些行会导致错误?
A、line 1
B、line 2
C、line 5
D、line 8
:
A、/**...**/
B、/*...*/
C、//
D、/**...*/
3. 欲编写如下图一种界面,用于显示顾客指定图像:如果在区域A中只能放置一种AWT组件,从各组件本来功能角度考虑,最佳使用哪种组件:
A、TextArea
B、Panel
C、Applet
D、Canvas
4. 界面如上题所示。若"Button1"功能是:点击后弹出一种用于输入界面,获取顾客想要显示图像文献名,则该界面最佳是
A、模式(Modal)Dialog
B、非模式(None-modal)Dialog
C、FileDialog
D、Frame
5. 界面如上题所示。如果在A区域使用某种AWT组件()来负责绘制图像,则绘图语句最佳应放在该组件哪个办法中(考虑到应用程序和Java虚拟机AWT线程都会规定重画该组件)?
A、构造办法
B、paint(Graphics g)
C、update(Graphics g)
D、repaint()
A、Applet也需要main办法
B、
C、Applet能访问本地文献
D、Applet程序不需要编译
:
class Aclass{
void go(){
("Aclass");
}
}
public class Bclass extends Aclass{
void go{
("Bclass");
}
public static void main(String args[]){
Aclass a=new Aclass();
Aclass a1=new Bclass();
();
();
}
以上程序运营成果是:
A、Aclass
Aclass
B、Bclass
Bclass
C、Aclass
Bclass
D、Bclass
Aclass
A、每一种Java线程可以当作由代码、一种真实CPU以及数据三部份构成。
B、创立线程两种办法中,从Thread类中继承创立方式可以防止浮现多父类问题。
C、。
D、以上说法无一对的。
:
boolean a=false;
boolean b=true;
boolean c=(a&&b)&&(!b);
int result=c==false?1:2;
这段程序执行完后,c与result值是:
A、c=false;result=1;
B、c=true;result=2;
C、c=true;result=1;
D、c=false;result=2;
,会产生什么成果
public class X extends Thread implements Runable{
public void run(){
("this is run()");
}
public static void main(String args[])
{
Thread t=ne
2022年Java程序设计模拟试题一 来自淘豆网m.daumloan.com转载请标明出处.