JAVA复习题三卷合一版(陈玲修改)1(7)

2019-08-26 17:32

33. ★ 给出下面代码: public class Person{

static int arr[] = new int[10]; public static void main(String a[]) {

System.out.println(arr[1]);

}

}

那个语句是正确的?

A 编译时将产生错误;

B 编译时正确,运行时将产生错误; C 输出零; D 输出空。

34. 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.

35. 类Teacher和Student是类Person的子类; Person p; Teacher t; Student s;

//p, t and s are all non-null.

if(t instanceof Person) { s = (Student)t; } 最后一句语句的结果是:

A 将构造一个Student对象; B 表达式是合法的; C 表达式是错误的;

D 编译时正确,但运行时错误。

36. 哪个关键字可以抛出异常?

A transient B finally C throw D static

37. Main()方法的返回类型是:

A int B void C Boolean D static

38. 哪个关键字可以对对象加互斥锁?

A transient C serialize B synchronized D static

31

39. ★下列哪些语句关于内存回收的说明是正确的?

A 程序员必须创建一个线程来释放内存; B 内存回收程序负责释放无用内存 C 内存回收程序允许程序员直接释放内存 D 内存回收程序可以在指定的时间释放内存对象

40. 欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的 ?

A. ArrayList myList=new Object(); B. List myList=new ArrayList(); C. ArrayList myList=new List(); D. List myList=new List();

二、 多选题(40题)

1. 下面的表达式哪个是正确的?

A String s=\你好\

B String s=\你好\C String s=\你好\D String s=\你好\

E String s=null; int i=(s!=null)&&(s.length>0)?s.length():0;

2. 选出合理的标识符

A _sys1_lll B 2mail C $change D class

3. ★ 哪个布局管理器使用的是组件的最佳尺寸( preferred size)

A FlowLayout B BorderLayout C GridLayout D CardLayout E GridBagLayout

4. ★下列哪个方法可用于创建一个可运行的类?

A public class X implements Runable{ public void run(){ ......} } B public class X implements Thread{ public void run(){ ......} } C public class X implements Thread{ public int run(){ ......} } D public class X implements Runable{ protected void run(){ ......} } E public class X extends Thread{ public void run(){ ......} }

5. ★下面哪个方法可以在任何时候被任何线程调用?

A notify() B wait() C notifyAll() D sleep()

E yield() F synchronized(this)

6. ★ 构造BufferedInputStream的合适参数是哪个?

32

A BufferedInputStream B BufferedOutputStream C FileInputStream D FileOuterStream E File

7. ★下列说法正确的是

A java.lang.Clonable是类 B java.lang.Runnable是接口 C Double对象在java.lang包中 D Double a=1.0是正确的java语句

8. ★ 指出正确的表达式

A double a=1.0; B Double a=new Double(1.0); C byte a = 340; D Byte a = 120;

9. ★ 定义一个类名为\的类,并且该类可被一个工程中的所有类访问,那么该类的正确声明应为:

A private class MyClass extends Object B class MyClass extends Object C public class MyClass

D public class MyClass extends Object

10. ★指出下列哪个方法与方法public void add(int a){}为合理的重载方法。

A public int add(int a) B public void add(long a) C public void add(int a,int b) D public void add(float a)

11. ★如果下列的方法能够正常运行,在控制台上将显示什么? public void example(){ try{ unsafe();

System.out.println(\}catch(SafeException e) { System.out.println(\

}finally{System.out.println(\System.out.println(\}

A Test 1 B Test 2 C Test 3 D Test 4

12. ★下列哪些是JAVA的修饰符?

A public B private C friendly D transient E vagrant

33

13. ★下面哪些语句是正确的?

A 如果多个监听器注册到一个组件只有最新一个监听器监听的事件会执行 B 如果多个监听器注册到一个组件所有的事件保证不分先后都会执行 C 注册多个监听器到一个组件会引起编译错误 D 你可以添加或删除多个监听器到一个组件 E int []a[] = new int[10][10];

14. ★ 下面哪些选项将是下述程序的输出? public class Outer{

public static void main(String args[]){

Outer: for(int i=0; i<3; i++)

inner:for(int j=0;j<3;j++){

if(j>1) break;

System.out.println(j+\

}

}

}

A 0 and 0 B 0 and 1 C 0 and 2 D 0 and 3 E 2 and 2 F 2 and 1 G 2 and 0

15. ★下面哪些语句能够正确地生成5个空字符串?

A String a[]=new String[5]; for(int i=0;i<5;a[++]=\B String a[]={\ C String a[5]; D String[5]a;

E String []a=new String[5]; for( int i=0;i<5;a[i++]=null);

16. ★ 下面哪个代码段不会出现编译错误?

A . import java.awt.*;

package Mypackage; class Myclass {} B . package MyPackage;

import java.awt.*; class MyClass{} C . /*This is a comment */

package MyPackage; import java.awt.*; class MyClass{}

34

17. ★下面标识符那些是JAVA中的保留字或关键字

A if B then C goto D while E case

18. 下面代码输出的结果是? public class MyFor{

public static void main(String argv[]){

int i; int j;

outer:for (i=1;i <3;i++)

inner: for(j=1; j<3; j++) {

if (j==2)

continue outer;

System.out.println(\

}

}

}

A Value for i=1 value for j=1 B Value for i=2 value for j=1 C Value for i=2 value for j=2 D Value for i=3 value for j=1

19. 那些方法可以插入到程序中注释片段位置? class Base{

public void amethod(int i) { }

}

public class Scope extends Base{

public static void main(String argv[]){} //Method Here(选择项插入位置)

}

A void amethod(int i) throws Exception {} B void amethod(long i)throws Exception {} C void amethod(long i){}

D public void amethod(int i) throws Exception {}

20. 在下面代码中那些修饰符可以放在XX位置 public class MyClass1 {

public static void main(String argv[]){ } /*修饰符位置 XX */ class MyInner {} }

35


JAVA复习题三卷合一版(陈玲修改)1(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2019年全国各地高考模拟作文题汇总分析

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: