45.在上题中,Beta类被称为▁▁类。
A.超类 B.子类 C.系统
D.用户自定义
46.一个▁▁类的对象可以当作相应的▁▁类对象看待。
A.子 系统
B.用户 系统 C.子 超 D.超 用户 47.请看下面的代码
1.class Example { 2. String str;
3. public Example( ){ 4. str = “example”; 5. }
6. public Example(String s){ 7. str = s; 8. }
9..}
10.class Demo extends Example {
11.}
12.public class Test{ 13. public void f(){
14. Example ex = new Example(“good”); 15. Demo d = new Demo(“Good”); 16. }
17.}
那一行将导致发生错误: A.3 B.6 C.10 D.14 E.15
48.请看下面的代码
public class Example{
String str = new String(“hello”); Char ch[ ]={‘d’,’b’,’c’};
public static void main(String args[ ]){ Example ex=new Example( ); ex.change(ex.str,ex.ch);
System .out .println(ex.str +“and”+ex.ch); }
public void change(String str,char ch[ ]){
str=”world”; ch[0]=’a’; } }
该程序的输出结果是: A.hello dbc B.hello abc C.world dbc D.world abc 49.下面选项正确的是:
A.String temp[ ]= new String{“j””a””z”}; B.String temp[ ]= {“j””a””z”}; C.String temp= {“j”,”a”,”z”}; D.String temp[ ]= {“j”,”a”,”z”}; 50.▁▁块可以防止资源泄露。
A.finally
B.catch
C.finally或catch D.任意
51.下面选项中的异常处理不是Java中预定以好的:
A.ArithmeticException
B.NullPointerException C.SecurityException
D.ArrayOutOfLengthException E. NegativeArraySizeException 52.用什么来声明一个出来处理:
A.try
B.catch C.throw D.finally
53、下列哪一种布局管理器将容器分为“东、西、南、北、中”五个部分?( )
A. FlowLayout B. BorderLayout C. GridLayout D. CardLayout E. GridBagLayout 54、关于Applet的生命周期正确的说法有( )。
A. init()方法在start()方法之后执行 B. init()方法可执行多次 C. stop()方法在Applet退出时被调用,只调用一次
D. stop()方法在Applet不可见时被调用,可以被调用多次
55、实现下列哪个接口可以对 TextField 对象的事件进行监听和处理? ( )
A. MouseMotionListener B. FocusListener C. ActionListener D. WindowListener 56、监听事件和处理事件( )。 A. 都由 Listener 完成 B. 由 Listener 和窗口分别完成
C. 由 Listener 和组件分别完成 D. 都由相应事件 Listener 处登记过的组件完成 57、下面语句正确的是:( )
A. RandomAccessFile raf = new RandomAccesssFile(“myfile.txt”,”rw”) B. RandomAccessFile raf = new RandomAccesssFile(new DataInputStream())
C. RandomAccessFile raf= new RandomAccesssFile(“myfile.txt”)
D. RandomAccessFile raf = new RandomAccesssFile(new File(“myfile.txt”)) 58、( )类是java.lang包中的一个专门用来创建线程和对线程进行操作的类。
A. Runnable B. Thread C. Synchronized 59、Java Application程序执行的入口是( )方法。 A.init() B. main() C.stop() D.start() 60、Java Applet程序执行的入口是( )方法。
A.init() B. main() C.stop() D.start() 二、多重选择题(2*20,共计40分) 1.请看下面的程序代码:
switch(n) {
case 0: System .out .println(“first”); case 1:
case 2: System .out .println(“second”); break; default: System .out .println(“end”); }
当n为何值时,程序段将输出字符串second: A.0 B.1 C.2
D.3
2.数组元素之所以相关,是因为它们具有相同的▁▁。
A.名字 B.类型
C.下标 D.地址
3.请看下面的程序段
public class Person{ String name;
int age;
public Person(String n,int a) { name=n; age=a;}
public static void main(String arg[ ]){ //point x }
}
下面选项可以添加到//point x处: A.Person p[ ]=new Person[3]; P[1]=new Person(“user1”;24); B.Person p[ ]; P=new Person[3];
P=new Person(“user2”;56);
C.Person p[ ]={ new Person(“user1’,34),(“user2”,34)} D.Person p[ ]=new Person{(“user1’,34),(“user2”,34)} 4.请看下面的程序段
public class Test{ String s;
int m;
public Test(String t ,int n){ s=t;m=n; }
public static void main(String arg[ ]){ Test t[ ]={ new Test(“abc”,3); new Test(“ddf”,23) }; //point x }
}
下面选项可以添加到//point x处:
A.System .out .println(“the value is”+t[3].s); B.System .out .println(“the value is”+t[2].m); C.System .out .println(“the value is”+t[1].s); D.System .out .println(“the value is”+t[1].m); 5.下面那一个不是Java的关键字:
A. TRUE B. sizeof C. const D. super E. void
6.下面语句书写错误的是:
A.String s = “Gone with the wind”; String t = “good”;
String k = s + t;
B.String s = “Gone with the wind”; String t;
t = s[3] + “one”;
C.String s = “Gone with the wind”; String standard = s.toUpperCase( ); D.String s = “home directory”; String t = s - “directory”; 7.请看下面的代码
String s = “hello”; String t = “hello”;
String c[ ] = {‘h’,’e’,’l’,’l’,’o’}; 下面哪一选项的语句返回值为真: A.s .equals(t);
相关推荐: