- 16
- 0
- 约5.73千字
- 约 9页
- 2017-04-12 发布于四川
- 举报
Java程序设计试卷6
《Java程序设计》试卷六
班级____学号____ 姓名_____ 成绩____
一.选择题(每题2分,共32分)
1.下面表达式中,用来访问数组中第一个值的是____
A、intArray[1] B、 intArray.1 C.intArray[0] D、intArray.0
2.监听事件和处理事件
A、都由Listener完成 B、都由相应事件Listener处登记过的构件完成
C、由Listener和构件分别完成 D、由Listener和窗口分别完成
3.如果希望所有的控件在界面上均匀排列,应使用下列那种布局管理器?
A、BoxLayout B、GridLayout C、BorderLayout D、FlowLouLayout
4.给出如下代码:
class Test{
private int m;
public static void fun() {
// some code...
}
}
如何使成员变量m 被函数fun()直接访问?
A、将private int m 改为protected int m
B、将private int m 改为 public int m
C、将private int m 改为 static int m
D、将private int m 改为 int m
5.下面的代码段中,执行之后i 和j 的值是什么?
int i = 1;
int j;
j = i++;
A、 1, 1
B、1, 2
C、2, 1
D、2, 2
6.欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的 ?
A ArrayList myList=new Object();
B List myList=new ArrayList();
C ArrayList myList=new List();
D List myList=new List();.paint()方法使用哪种类型的参数?
A Graphics
B、 Graphics2D
C、 String
D、 Color
8.指出正确的表达式
A byte=128;
B、 Boolean=null;
C、 long l=0xfffL;
D、 double=0.9239d;
9.指出下列程序运行的结果 public class Example{ String str=new String(good); char[]ch={a,b,c}; public static void main(String args[]){ Example ex=new Example(); ex.change(ex.str,ex.ch); System.out.print(ex.str+ and ); Sytem.out.print(ex.ch); } public void change(String str,char ch[]){ str=test ok; ch[0]=g; } }
A good and abc
B、 good and gbc
C、test ok and abc
D、 test ok and gbc 10.运行下列程序, 会产生什么结果 public class X extends Thread implements Runable{ public void run(){ System.out.println(this is run()); } public static void main(String args[]) { Thread t=new Thread(new X()); t.start(); } }
A 第一行会产生编译错误
B 第六行会产生编译错误
C 第六行会产生运行错误
D 程序会运行和启动 .要从文件 file.dat文件中读出第10个字节到变量C中,下列哪个方法适合?
A FileInputStream in=new FileInputStream(file.dat); in.skip(9); int c=in.read();
B、 FileInputStream in=new FileInputStream(file.dat); in.skip(10); int c=in.read();
C、 FileInputStream in=new FileInputStream(file.dat); int c=in.read();
D、 RandomAccessFile i
您可能关注的文档
最近下载
- 【市质检二检】泉州市2026届高中毕业班质量监测(二) 语文试卷(含官方答案).docx
- Triumph凯旋摩托 探险和旅游 Tiger 800 XCA 2018车主手册说明书(中文).pdf VIP
- 飞行qar首都航空品质监控.pdf VIP
- 电商运营自学全套教程【电商运营教学标准】.pdf VIP
- 2025年设备更新优秀案例集.docx
- 加速器简介.ppt VIP
- 天台宗的历史地位.docx VIP
- 2024-2025学年初中英语八年级下册仁爱科普版(2024)教学设计合集.docx
- 原神家具负荷表及计算器说明书(多功能小鹏).docx VIP
- 施工现场安全事故应急预案专项方案.doc VIP
原创力文档

文档评论(0)