- 5
- 0
- 约2.49万字
- 约 42页
- 2021-03-24 发布于江苏
- 举报
《Java程序设计》理论题库—选取题(单选175题)
?
1.欲构造ArrayList类一种实例,此类继承了List接口,下列哪个办法是对的 ? B
A、ArrayList myList=new Object();
B、List myList=new ArrayList();
C、ArrayList myList=new List();
D、List myList=new List();
2.paint()办法使用哪种类型参数?A
A、Graphics
B、Graphics2D
C、String
D、Color
3.指出对的表达式 D
A、byte=128;//byte取值到127
B、Boolean=null;
C、long l=0xfffL;
D、double=0.9239d;
4.指出下列程序运营成果 Bpublic 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 5.运营下列程序,会产生什么成果 C Dpublic 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、程序会运营和启动 6.要从文献 file.dat文献中读出第10个字节到变量C中,下列哪个办法适合?A
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 in=new RandomAccessFile(file.dat);in.skip(9);int c=in.readByte();7.容器被重新设立大小后,哪种布局管理器容器中组件大小不随容器大小变化而变化? B
A、CardLayout
B、FlowLayout
C、BorderLayout
D、GridLayout 8.给出下面代码: public class Person{ static int arr[] = new int[10]; public static void main(String a[]) { System.out.println(arr[1]); } } 那个语句是对的? C
A、编译时将产生错误;
B、编译时对的,运营时将产生错误;
C 、输出零;
D、输出空。 9.哪个核心字可以对对象加互斥锁? B
A、transient
B synchronized
C serialize
D static 10.下列哪些语句关于内存回收阐明是对的?B
A、程序员必要创立一种线程来释放内存;
B、内存回收程序负责释放无用内存
C、内存回收程序容许程序员直接释放内存
D、内存回收程序可以在指定期间释放内存对象 11.下列代码哪几行会出错:C1) public void modify() { 2) int I,j,k;3) I = 100;4) while ( I 0 ) { 5) j = I * 2;6
原创力文档

文档评论(0)