选择题(五)
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
138.运行下列程序, 会产生什么结果 ( ?????)
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、 程序会运行和启动
139.要从文件" 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 in=new RandomAccessFile("file.dat"); in.skip(9); int c=in.readByte();
140.容器被重新设置大小后,哪种布局管理器的容器中的组件大小不随容器大小的变化而改变?( ?????) ?
A、 CardLayout B、 FlowLayout C、 BorderLayout D、 GridLayout
141.给出下面代码:
public class Person{
static int arr[] = new int[10];
public static void main(String a[])
{
System.out.println(arr[1]);
}
}
那个语句是正确的? ( ?????)
A、 编译时将产生错误; B、 编译时正确,运行时将产生错误;
C 、输出零;
D、 输出空。
142.哪个关键字可以对对象加互斥锁? ( ?????)
A、 transient B、 synchronized C、 serialize D、 static
143.下列哪些语句关于内存回收的说明是正确的? ( ?????)
A、 程序员必须创建一个线程来释放内存; B、 内存回收程序负责释放无用内存
C、内存回收程序允许程序员直接释放内存 D、内存回收程序可以在指定的时间释放内存对象
144.下列代码哪几行会出错: ( ?????)
1) public void modify() {
2) int I, j, k;
3) I = 100;
4) while ( I > 0 ) {
5) j = I * 2;
6) System.out.println (" The value of j is " + j );
7) k = k + 1;
8) I--;
9) }
10} }
A、 line 4 B、 line 6 C、 line 7 D、
line 8
145、数组中可以包含什么类型的元素?( ?????)
A、int型 B、 string型 C、 数组 D、 以上都可以
146、为AB类的一个无形式参数无返回值的方法method书写方法头,使得使用类名AB作为前缀就可以调用它,该方法头的形式为(????? )。
?
?? A.? static? void? method( )?????????????? B. public? voidmethod( )???
C. final? void? method( )?????????????? D. abstract? void method( )
147、编译Java? Application 源程序文件将产生相应的字节码文件,这些字节码文件的扩展名为(????? )。
A.??? .java?????????B.??? .class?? C.??? .html???????? D.??? .exe
?
148、如果类中的成员变量可以被同一包访问,则使用如下哪个约束符?
?A、 private??B、public??C、protected??D、no modifier
149、以下哪个方法用于定义线程的执行体?
?A、 start()??B、init()??C、run()??D、main()
?
150.MAX_LENGTH是int型public成员变量, 变量值保持为常量100,用简短语句定义这个变量。 ( ?????)
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.