JAVA程序的设计考试卷(附答案)(1)

上传人:xmg****18 文档编号:118730167 上传时间:2019-12-24 格式:DOC 页数:5 大小:47.50KB
返回 下载 相关 举报
JAVA程序的设计考试卷(附答案)(1)_第1页
第1页 / 共5页
JAVA程序的设计考试卷(附答案)(1)_第2页
第2页 / 共5页
JAVA程序的设计考试卷(附答案)(1)_第3页
第3页 / 共5页
JAVA程序的设计考试卷(附答案)(1)_第4页
第4页 / 共5页
JAVA程序的设计考试卷(附答案)(1)_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《JAVA程序的设计考试卷(附答案)(1)》由会员分享,可在线阅读,更多相关《JAVA程序的设计考试卷(附答案)(1)(5页珍藏版)》请在金锄头文库上搜索。

1、. . . . .天津城市建设学院20072008学年第二学期 java语言程序设计A 试题A卷一、 填空(本题共15空,每空2分,共30分)1如果一个java源程序文件中定义有4个类,使用sun公司的JDK编译器javac编译该源程序文件将产生_4_个文件名与类名相同扩展名为_.Class_的字节码文件。2Java中所有类都是类 _Object_的子类。3请填出在javalang包中与下列基本数据类型相对应的封装类: float:javalangFloat, char: _ javaLang.char_, boolean: _ javaLang.boolean_。 4被关键字_final_修

2、饰的方法是不能被当前类的子类重新定义的方法5线程的四种状态是_新建_ 、_运行_ 、_中断 、_死亡_。6java语言中_java.lang.Objet _是所有类的根。7Swing的事件处理机制包括_事件的监听者_、事件和事件处理者。8URL_Uniform Resourse Locator_是的缩写。9java有两类应用程序java Application和_java applet_。10转义字符以_开头。二、选择(本题共20小题,每题2分,共40分)1欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的 ? ( B )A、 ArrayList myList=

3、new Object(); B、 List myList=new ArrayList(); C、 ArrayList myList=new List(); D、 List myList=new List();2paint()方法使用哪种类型的参数? ( A )A、 Graphics B、 Graphics2D C、 String D、 Color3指出正确的表达式 ( C )A、 byte=128; B、 Boolean=null; C、 long l=0xfffL; D、 double=09239d; 4指出下列程序运行的结果 ( B )public class Example String

4、 str=new String(good); charch=a,b,c; public static void main(String args) Example ex=new Example(); exchange(exstr,exch); Systemoutprint(exstr+ and ); Sytemoutprint(exch); public void change(String str,char ch) str=test ok; ch0=g; B、 good and abc B、 good and gbc C、test ok and abc D、 test ok and gbc

5、5运行下列程序, 会产生什么结果 ( A )public class X extends Thread implements Runable public void run() Systemoutprintln(this is run(); public static void main(String args) Thread t=new Thread(new X(); tstart(); A、 第一行会产生编译错误 B、 第六行会产生编译错误 C、 第六行会产生运行错误 D、 程序会运行和启动 6要从文件 filedat文件中读出第10个字节到变量C中,下列哪个方法适合? ( D )A、 F

6、ileInputStream in=new FileInputStream(filedat); inskip(9); int c=inread(); B、 FileInputStream in=new FileInputStream(filedat); inskip(10); int c=inread(); C、 FileInputStream in=new FileInputStream(filedat); int c=inread(); D、 RandomAccessFile in=new RandomAccessFile(filedat); inskip(9); int c=inread

7、Byte(); 7容器被重新设置大小后,哪种布局管理器的容器中的组件大小不随容器大小的变化而改变? ( B )A、 CardLayout B、 FlowLayout C、 BorderLayout D、 GridLayout 8给出下面代码: public class Person static int arr = new int10;public static void main(String a) Systemoutprintln(arr1); 那个语句是正确的? ( C )A、 编译时将产生错误; B、 编译时正确,运行时将产生错误; C 、输出零; D、 输出空。 9下列那个是反斜杠的

8、正确表示?( A )A、 B、 * C、 D、 10下列哪些语句关于内存回收的说明是正确的? ( B )A、 程序员必须创建一个线程来释放内存; B、 内存回收程序负责释放无用内存 C、内存回收程序允许程序员直接释放内存 D、内存回收程序可以在指定的时间释放内存对象 11下列代码哪几行会出错: ( C )1) public void modify() 2) int I, j, k; 3) I = 100; 4) while ( I 0 ) 5) j = I * 2; 6) Systemoutprintln ( The value of j is + j ); 7) k = k + 1; 8)

9、I-; 9) 10 A、 line 4 B、 line 6 C、 line 7 D、 line 812MAX_LENGTH是int型public成员变量, 变量值保持为常量100,用简短语句定义这个变量。 ( D )A、 public int MAX_LENGTH=100; B、 final int MAX_LENGTH=100; C、 final public int MAX_LENGTH=100; D、 public final int MAX_LENGTH=100 13给出下面代码:1) class Parent 2 private String name; 3 public Paren

10、t() 4 5) public class Child extends Parent 6 private String department; 7 public Child() 8 public String getValue() return name; 9 public static void main(String arg) 10 Parent p = new Parent(); 11 12 那些行将引起错误? ( D )A、 第3行 B、 第6行 C、 第7行 D、 第8行14类Teacher和Student是类Person的子类; Person p; Teacher t; Stude

11、nt s; /p, t and s are all non-null if(t instanceof Person) s = (Student)t; 最后一句语句的结果是: ( D )A、 将构造一个Student对象; B、 表达式是合法的; C、 表达式是错误的; D、 编译时正确,但运行时错误。 15给出下面代码段 1) public class Test 2) int m, n; 3) public Test() 4) public Test(int a) m=a; 5) public static void main(String arg) 6) Test t1,t2; 7) int

12、 j,k; 8) j=0; k=0; 9) t1=new Test(); 10) t2=new Test(j,k); 11) 12) 哪行将引起一个编译时错误? ( D )A、 line 3 B、 line 5 C、 line 6 D、 line 10 16对于下列代码: 1) class Person 2) public void printValue(int i, int j) / 3) public void printValue(int i)/ 4) 5) public class Teacher extends Person 6) public void printValue() /

13、 7) public void printValue(int i) / 8) public static void main(String args) 9) Person t = new Teacher(); 10) tprintValue(10); 11) 第10行语句将调用哪行语句?( D )A、 line 2 B、 line 3 C、 line 6 D、 line 717哪个关键字可以抛出异常? ( C )A、 transient B、 finally C、 throw D、 static 18Main()方法的返回类型是: ( B )A、 int B、 void C、 boolean D、 static 19( C )布局管理器使容器中各个构件呈网格布局,平局占据容器空间。A、 FlowLayout

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 大杂烩/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号