java选择题(二)

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

A、 ArrayList myList=new Object();

B、 List myList=new ArrayList();

C、 ArrayList myList=new List();

D、 List myList=new List();

3.指出正确的表达式 D

A、 byte=128; //byte取值到127

B、 Boolean=null;

C、 long l=0xfffL;

D、 double=0.9239d;

4.指出下列程序运行的结果 B
public 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.运行下列程序, 会产生什么结果   D
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、 程序会运行和启动


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();

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、 输出空。

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) 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

12.MAX_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 Parent(){}
  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;
   Student s;
   //p, t and s are all non-null.
   if(t instanceof Person) { s = (Student)t; }
  最后一句语句的结果是: C

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 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() {//... }
  7) public void printValue(int i) {//...}
  8) public static void main(String args[]){
  9) Person t = new Teacher();
  10) t.printValue(10);
  11) }
  第10行语句将调用哪行语句?? D

A、 line 2

B、 line 3

C、 line 6

D、 line 7


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

A、 transient

B、 finally

C、 throw

D、 static


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

A、 int

B、 void

C、 boolean

D、 static


19.System类在哪个包中? D

A、 java.util

B、 java.io

C、 java.awt

D、 java.lang


20.对于下列代码: 
  public class Parent {
   public int addValue( int a, int b) {
     int s;
     s = a+b;
     return s;
   }
  }
  class Child extends Parent {
  }
 下述哪些方法可以加入类Child? C

A、 int addValue( int a, int b ){// do something...}

B、 public void addValue (int a, int b ){// do something...}

C、 public int addValue( int a ){// do something...}

D、 public int addValue( int a, int b )throws MyException {//do something...}


21.给出下面代码:
  public class test{
   static int a[] = new a[10];
   public static void main(String args[]) {
    System.out.println(a[10]);
   }
  }
那个选项是正确的? A
A、 编译时将产生错误;

B、 编译时正确,运行时将产生错误;

C、 输出零;

D、 输出空。


23.给定下面的代码片段: C
  1) String str = null;
  2) if ((str != null) && (str.length() > 10)) {
  3) System.out.println("more than 10");
  4) }
  5) else if ((str != null) & (str.length() < 5)) {
  6) System.out.println("less than 5");
  7) }
  8) else { System.out.println("end"); }
哪些行会导致错误?

A、 line 1

B、 line 2

C、 line 5

D、 line 8


24.下面哪种注释方法能够支持javadoc命令:  D

A、 /**...**/

B、 /*...*/

C、 //

D、 /**...*/

29.看下面一段程序:
  class Aclass{
   void go(){
    System.out.println("Aclass");
   }
  }
  public class Bclass extends Aclass{
   void go(){
    System.out.println("Bclass");
   }
  public static void main(String args[]){
   Aclass a=new Aclass();
   Aclass a1=new Bclass();
  a.go();
  a1.go();
  }
以上程序运行结果是: C

A、 Aclass
   Aclass

B、 Bclass
   Bclass

C、 Aclass
   Bclass

D、 Bclass
   Aclass


30.下列关于Java线程的说法那些是正确的() D

A、 每一个Java线程可以看成由代码、一个真实的CPU以及数据三部份组成。

B、 创建线程的两种方法中,从Thread类中继承的创建方式可以防止出现多父类问题。

C、 Thread类属于java.util程序包。

D、 以上说法无一正确。


31.看以下程序: 
  boolean a=false;
  boolean b=true;
  boolean c=(a&&b)&&(!b);
  int result=(c= =false)?1:2;
这段程序执行完后,c与result的值是:A

A、 c=false;result=1;

B、 c=true;result=2;

C、 c=true;result=1;

D、 c=false;result=2;


32.运行下列程序, 会产生什么结果  B

  public class X extends Thread implements Runnable{
  public void run(){
   System.out.println("this is run()");
  }
  public static void main(String args[])
  {
   Thread t=new Thread(new X());
   t.start();
   }
  }

A、 in the Inner outer

B、 this is run()

C、 in the Inner

D、编译不通过

33.指出下列程序的运行结果 B
  int i = 9;
  switch (i) {
  default:
  System.out.println("default");
  case 0:
  System.out.println("zero");
  break;
  case 1:
  System.out.println("one");
  case 2:
  System.out.println("two");
  }

A、 default

B、 default, zero

C、 error default clause not defined

D、 no output displayed那个

34.运行下列程序,会产生什么结果:B 
  class Outer1{
   private int a;
   void foo(double d,final float f){
    String s;
    final boolean b;
    class Inner{
     void methodInner(){
      System.out.println("in the Inner");
     }
    }
   }
   public static void main(String args[])
  {
  Outer1 me=new Outer1();
  me.foo(123,123);
  System.out.println("outer");
  }
 }

A、 in the Inner outer

B、 outer

C、 in the Inner

D、 编译不通过

35. 下面哪个单词是Java语言的关键字(    B     )

A、Float

B、this

C、string

D、unsigned 

36. 下面哪个是Java语言中正确的标识符(    C       )

A、3com

B、import

C、that

D、this 

37. 下面哪个语句不能定义一个字符变量      D   )

A、char c1=06477;

B、char c2=’uface’ ;

C、char c4=0xbeef ;

D、char c3=u0041; 

38. 下面哪个修饰符修饰的方法只能被本类中的其他方法使用(     C      )

A、protected

B、static

C、private

D、public 

39. 下面哪个运算后结果为32  (      B      )

A、2^5

B、(8>>2)<<4

C、2>>5

D、(2<<1)*(32>>3) 

40. 下面哪个是对字符串String的正确定义    A        )

A、String s1=null;B、String s2=’null’ ;

C、String s3=(String) ‘abc’ ;D、String s4=(String) ‘uface’;

41. 下面哪条语句不能定义一个float型的变量  B       )

A、float f1= -343 ;

B、float f2=3.14 ;

C、float f3=0x12345 ;

D、float f4=2.8F ; 

42. 下面哪条语句定义了5个元素的数组(   A       )

A、int [] a={22,23,24,25,12};

B、int a []=new int(5);

C、int [5] array;

D、int [] arr;

43. 下面哪个范围是char型的取值范围    c      )

A、-256 ~ 255

B、-(2^15) ~ (2^15)-1

C、’u0000’ ~ ‘uffff’

D、0~3276 

44. 给出一段程序,选择运行结果(     D      )

public class sss {

public static void main(String args[])

{

String s1=args[1];    String s2=args[2];

String s3=args[3];    String s4=args[4];

System.out.println(“args[2]=”+s2);

}

}

命令行执行:  java sss 1 2 3 4   结果是下面哪一个?

A、args[2]=2

B、args[2]=null

C、args[2]=1

D、运行出现异常

46. 给出一段程序,试判断哪个是正确的结果    B      )

public class rtExcept {
    public static void throwit() {
        System.out.print("throwit");
        throw new RuntimeException();
    }
    public static void main(String[] aa) {
        try {
            System.out.print("hello");
            throwit();
        } catch (Exception re) {
            System.out.print("caught ");
        } finally {
            System.out.print("finally");
        }
        System.out.print("after");
    }
}

A、hello throwit caught

B、hello throwit caught finally after

C、hello throwit RuntimeException after

D、hello throwit caught finally after RuntimeException

47. 对一个java源文件 aaa.java,编辑保存后但未编译,在其所在目录下执行 java aaa,则接着会出现什么(     C      )

A、error: cannot read: aaa.java

B、无任何显示

C、Exception in thread "main" java.lang.NoClassDefFoundError: aaa

D、程序正常执行并显示

48. 编译java程序时出现error: cannot read: aaa.java,则下列原因最正确的是        A    )

A、原因是执行的当前目录下没有找到aaa.java文件。

B、原因是没有安装JDK开发环境。

C、原因是java源文件名后缀一定是以 .txt 结尾。

D、原因是JDK安装后没有正确设置环境变量PATH和Classpath 。

49. 给出一段程序,试判断哪个是正确的结果(    D         )

public class myprogram{

public static void main (String args[]){

try{

System.out.print(“Hello world ”); }

finally{

System.out.println(“Finally executing”);

}

}

}

A、无法编译,因为没有指定异常

B、无法编译,因为没有catch子句

C、Hello world

D、Hello world Finally executing

50. 下面哪个是Java语言中正确的标识符(    B       )

A、3D

B、$this

C、extends

D、implements

51. 下面哪个范围是char型的取值范围(    C      )

A、-256 ~ 255

B、-(2^15) ~ (2^15)-1

C、’u0000’ ~ ‘uffff’

D、0~32767

52. 下面哪个语句不能定义一个字符变量(    D      )

A、char c1=3210;

B、char c2=’uface’ ;

C、char c4=0xabcd ;

D、char c3=”u0065”;

53. 下面哪个是对字符串String的正确定义 (    A      )

A、String s1=” null”;

B、String s2=’null’ ;

C、String s3=(String) ‘abc’ ;

D、String s4=(String) ‘uface’;

54. 给出下面一段程序,选择运行结果(    C      )

public class X{

   public static void main(String [] args){

  String names[]=new String[5];

  for(int x=0;x<args.length;x++)  {

    names[x]=args[x];

  }

    System.out.println(names[2]);

}}

命令行执行:  java X a b   结果是下面哪一个?

A、names

B、b

C、null

D、运行出现异常

56. 下面哪项可以得到数组元素的个数,java中定义数组名为 abc,(       B        

A、abc.length( )

B、abc.length

C、len(abc)

D、ubound(abc)

57.下面哪个修饰符修饰的变量是所有同一个类生成的对象共享的(      C   )

A、public  B、private  C、static  D、final

59.下面关于java中类的说法哪个是不正确的     C      )

A、类体中只能有变量定义和成员方法的定义,不能有其他语句。

B、构造函数是类中的特殊方法。

C、类一定要声明为public的,才可以执行。

D、一个java文件中可以有多个class定义。

60. 下面程序运行后的输出结果为 C  )

class A {
    static int y = 6;
    void showy() {
        System.out.println("y =" + y);
    }
}
class testA {
    public static void main(String aaa[]) {
        A a1 = new A();
        A.y += 1;
        a1.y++;
        a1.showy();
    }
}

输出结果选择:

A、y=6;B、y=7;C、y=8;D、程序运行出错

61. 编译java程序时出现error: cannot read: aaa.java,则下列原因最正确的是(  A   )

A、原因是执行的当前目录下没有找到aaa.java文件。

B、原因是没有安装JDK开发环境。

C、原因是java源文件名后缀一定是以 .txt 结尾。

D、原因是JDK安装后没有正确设置环境变量PATH和Classpath 。

62. 下面关于构造函数的说法不正确的是(  B  )

A、构造函数也属于类的方法,用于创建对象的时候给成员变量赋值。

B、构造函数不可以重载。

C、构造函数没有返回值。

D、构造函数一定要和类名相同。

63. 在java的一个异常处理中,哪个语句块可以有多个 (       A      )

A、catch

B、finally

C、try

D、throws

64. 对一个java源文件 aaa.java,编辑保存后但未编译,在其所在目录下执行 java aaa,则接着会出现什么(     C      )

A、error: cannot read: aaa.java

B、无任何显示

C、Exception in thread "main" java.lang.NoClassDefFoundError: aaa

D、程序正常执行并显示

65.下面表达式中,用来访问数组中第一个值的是__C__

A、intArray[1]  B、 intArray.1  C.intArray[0]  D、intArray.0

66.监听事件和处理事件    B

A、都由Listener完成  B、都由相应事件Listener处登记过的构件完成  

C、由Listener和构件分别完成  D、由Listener和窗口分别完成

68.给出如下代码:

class Test{

  private int m;

  public static void fun() {

    // some code...

  }

}

如何使成员变量m 被函数fun()直接访问?  C

 A、将private int m 改为protected int m

 B、将private int m 改为 public int m

 C、将private int m 改为 static int m

 D、将private int m 改为 int m

69.下面的代码段中,执行之后i 和j 的值是什么?  C

int i = 1;

int j;

j = i++;

 A、 1, 1     B、1, 2      C、2, 1        D、2, 2

72.指出正确的表达式 C

A、 byte=128;

B、 Boolean=null;

C、 long l=0xfffL;

D、 double=0.9239d;

73.指出下列程序运行的结果   D
public 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

81、数组中可以包含什么类型的元素?____D___。

A、int型 B、 string型 C、数组 D、 以上都可以

82、为AB类的一个无形式参数无返回值的方法method书写方法头,使得使用类名AB作为前缀就可以调用它,该方法头的形式为(   B   )。

A.  static  void  method( )                    B. public  void  method( )    

C. final  void  method( )                      D. abstract  void  method( )

83、编译Java  Application 源程序文件将产生相应的字节码文件,这些字节码文件的扩展名为(  B    )。

         A.    .java                      B.    .class

         C.    .html                      D.    .exe

84、如果类中的成员变量可以被同一包访问,则使用如下哪个约束符?   D

 A、 private       B、public       C、protected         D、no modifier

85、以下哪个方法用于定义线程的执行体? A

 A、 start()     B、init()       C、run()             D、main()

86.MAX_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.


87.给出下面代码:
  1) class Parent {
  2} private String name;
  3} public Parent(){}
  4} }
  5) public class Child extends Parent {
  6} private String department;
  7} public Child() {}
  8} public String getValue(){ return name; }//name获取不到
  9} public static void main(String arg[]) {
  10} Parent p = new Parent();
  11} }
  12} }
  那些行将引起错误? D
A、 第3行

B、 第6行

C、 第7行

D、 第8行


88.类Teacher和Student是类Person的子类;
   Person p;
   Teacher t;
   Student s;
   //p, t and s are all non-null.
   if(t instanceof Person) { s = (Student)t; }
  最后一句语句的结果是: C

A、 将构造一个Student对象;

B、 表达式是合法的;

C、 表达式是错误的;

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


89.给出下面代码段
  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 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

90.对于下列代码:
  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() {//... }
  7) public void printValue(int i) {//...}
  8) public static void main(String args[]){
  9) Person t = new Teacher();
  10) t.printValue(10);
  11) }
  第10行语句将调用哪行语句?? D

A、 line 2

B、 line 3

C、 line 6

D、 line 7

93.System类在哪个包中? D

A、 java.util

B、 java.io

C、 java.awt

D、 java.lang


94.对于下列代码:
  public class Parent {
   public int addValue( int a, int b) {
     int s;
     s = a+b;
     return s;
   }
  }
  class Child extends Parent {
  }
 下述哪些方法可以加入类Child?   c

A、 int addValue( int a, int b ){// do something...}

B、 public void addValue (int a, int b ){// do something...}

C、 public int addValue( int a ){// do something...}

D、 public int addValue( int a, int b )throws MyException {//do something...}

96.下面哪些选项是正确的main方法说明? B

A、 public main(String args[])

B、 public static void main(String args[])

C、 private static void main(String args[])

D、 void main()

97.Java语言具有许多优点和特点,下列选项中,哪个反映了Java程序并行机制的特点( B )

A 安全性    B 多线程   C 跨平台    D 可移植

98.下列哪个类声明是正确的( D )

A abstract final class H1{…}

B abstract private move(){…}

C protected private number;

D public abstract class Car{…}

99.下列关于for循环和while循环的说法中哪个是正确的( D )

A while循环能实现的操作,for循环也都能实现

B while循环判断条件一般是程序结果,for循环判断条件一般是非程序结果

C 两种循环任何时候都可替换

D 两种循环结构中都必须有循环体,循环体不能为空

100.异常包含下列哪些内容( C )

A 程序中的语法错误

B 程序的编译错误

C 程序执行过程中遇到的事先没有预料到的情况

D 程序事先定义好的可能出现的意外情况

101.Character流与Byte流的区别是( C )

A 每次读入的字节数不同

B 前者带有缓冲,后者没有

C 前者是块读写,后者是字节读写

D 二者没有区别,可以互换使用

102.监听事件和处理事件( B )

A 都由Listener完成

B 都由相应事件Listener处登记过的构件完成

C 由Listener和构件分别完成

D 由Listener和窗口分别完成

103.Applet可以做下列哪些操作( A )

A 读取客户端文件

B 在客户端主机上创建新文件

C 在客户端装载程序库

D 读取客户端部分系统变量

106.为实现多线程之间的通信,需要使用下列哪种流才合适( D )

A Filter stream

B File stream

C Random access stream

D Piped stream

107.函数重载是指 ( A)
A.两个或两个以上的函数取相同的函数名,但形参的个数或类型不同
B.两个以上的函数取相同的名字和具有相同的参数个数,但形参的类型可以不同
C.两个以上的函数名字不同,但形参的个数或类型相同
D.两个以上的函数取相同的函数名,并且函数的返回类型相同


108.指出下列程序运行的结果(B)

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");
        System.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


109.运行下列程序,会产生的结果是(D)

public class rtExcept extends Thread implements Runnable{
    public void run(){
        System.out.println("this is run()");
    }
    public static void main(String args[]){
        Thread t=new Thread(new rtExcept());
        t.start();
    }
}

A.第一行会产生编译错误               B.第六行会产生编译错误

C.第六行会产生运行错误          D.程序会运行和启动


120.对于catch子句的排列,下列哪种是正确的(A )
A.父类在先,子类在后
B.子类在先,父类在后
C.有继承关系的异常不能在同一个try程序段内
D.先有子类,其他如何排列都无关  


121.构造方法何时被调用(B ) 
A.类定义时           B.创建对象时
C.调用对象方法时        D.使用对象的变量时


122.下面的表达式中正确的是( )  A
A.String s=″你好″;int i=3;s+=i;
B.String s=″你好″;int i=3;if(i==s){s+=i};
C.String s=″你好″;int i=3;s=i+s;
D.String s=″你好″;int i=3;s=i+;

123.Java中,数值类型值中可能出现的符号是(B )
A.R    B.D   C.T   D.Y


124.在异常处理中,如释放资源、关闭文件、关闭数据库等由( C)来完成。
A.try子句           

B.catch子句

C.finally子句         

D.throw子句


125.要从文件″file.dat″文件中读出第10个字节到变量C中,下列哪个方法适合(A )
A.FileInputStream in=new FileInputStream(″file.dat″);in.skip9.;int c=in.read();
B.FileInputStream in=new FileInputStream(″file.dat″);in.skip10.;int c=in.read();
C.FileInputStream in=new FileInputStream(″file.dat″);int c=in.read();
D.RandomAccssFile in=RandomAccssFile(″file.dat″);in.skip9.;int c=in.readByte();


126.如果任何包中的子类都能访问超类中的成员,那么应使用哪个限定词( C)
A.public             B.private
C.protected            D.transient


127.运行下列程序的结果是( C)
abstract class MineBase{
abstract void amethod();
static int i;
}
public class Mine extends MineBase
{
public static void main(String argv[]){
int[] ar=new int[5];
for(i=0;i System.out.println(ar[i]);
}
}
A.打印5个0               B.编译出错,数组ar[]必须初始化
C.编译出错,Mine应声明为abstract    D.出现IndexOutOfBoundes的例外


128.下列运算结果默认为float的是(C)
A.100/10                B.100*10
C.100F+10                D.100D-10


129.下列语句byte b=011;System.out.priftln(b);输出结果为( C)
A.B                  B.11
C.9                  D.001


130.在Java中,不属于整数类型变量的是(A )
A.double               B.long
C.int                 D.byte


131.下面属于Java关键字的是(C )
A.NULL                B.IF
C.do                 D.goto


133.Java虚拟机的执行过程有多个特点,下列哪个特点不属于JVM执行特点(D )
A.多线程               B.动态连接
C.异常处理              D.异步处理


144.Java中哪个类提供了随机访问文件的功能(A )
A.RandomAccessFile类        B.RandomFile类
C.File类              D.AccessFile类


145.当方法遇到异常又不知如何处理时,下列哪种说法是正确的( C)
A.捕获异常             B.抛出异常
C.声明异常             D.嵌套异常


146.Java程序的执行过程中用到一套JDK工具,其中java.exe是指( B)
A.Java文档生成器          B.Java解释器
C.Java编译器            D.Java类分解器


148.Java窗体设计程序运行时,在命令行下用( C)键可以终止程序的运行
A.F6                B.F5
C.Ctrl+C              D.Ctrl+S


149.Java语言中,下列标识符错误的是(B )
A.diss                B.�—name
C.&count              D.—j


150.Java变量中,以下不属于复合类型的数据类型是(B )
A.类               B.字符型
C.数组型             D.接口


151.下面说法哪些是正确的( D)
A.Applet可以访问本地文件     

B.对static方法的调用需要类实例

C.socket类在java.lang中     

D.127.0.0/1地址代表本机

152.下面说法不正确的是(B )
A.Java中线程是抢占式的      B.Java中线程是分时的
C.Java中的线程可以共享数据    D.Java中的线程可以共享代码


153.下面属于Java线程同步方法的方法有( C)
A.joiny()            B.run()
C.wait()             D.destroy()


154.下列哪个方法可用于创建一个可运行的类(A )
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(){......} }


155.下列说法不正确的是(C )
A.IOException必须被捕获或抛出
B.java语言会自动初始化变量的值
C.java语言不允许同时继承一个类并实现一个接口
D.java语言会自动回收内存中的垃圾


156.Java程序的执行过程中用到一套JDK工具,其中java.exe是指( B)
A.Java文档生成器         B.Java解释器
C.Java编译器           D.Java类分解器


157.Java语言中,下列标识符错误的是( D )
A.—sys1             B.&—m
C.I               D.40name


158.在Java中,属于整数类型变量的是(C )
A.single             

B.double

C.byte             

D.char


159.Applet类的直接父类是(D )
A.Component类          B.Container类
C.Frame类            D.Panel类

161.在下列事件处理机制中哪个不是机制中的角色(C )
A.事件             B.事件源
C.事件接口           D.事件处理者


162.下列语句片段

int a=10,b=4,c=20,d=6;
System.out.println(a++*b+c*--d);
的结果为( C)
A.144             B.28
C.140             D.不能执行


163.下列语句片段:
int a=-67,b=116,c=78;
int d=~a|b&c;
System.out.println(d)的结果为( A)
A.70             B.67
C.78             D.56


164.对象使用时,下面描述错误的是( B) 
A.通过“.”运算符调用成员变量和方法
B.通过成员变量的访问权限设定限制自身对这些变量方法的调用
C.将一个对象申明为类的成员时,必须在使用前为其分配内存
D.在方法中使用对象作为参数时,采用引用调用


165.执行下列代码后,哪个结论是正确的String[] s=new String[10]; B
A.s[10]为″″            

B.s[9]为null

C.s[0]为未定义           

D.s.length为101


166.Java编程所必须的默认引用包为(B)
A.java.sys包             

B.java.lang包

C.java.new包             

D.以上都不是


167.定义一个类名为“MyClass.java”的类,并且该类可被一个工程中的所有类访问,那么该类的正确声明应为:(C )
A.private class MyClass extends Object

B.class MyClass extends Object

C.public class MyClass

D.private class MyClass extends Object


168.内部类是在一个类内嵌套定义的类。其特点描述错误的是(B )
A.只能在定义它的类或程序段中或表达式内匿名使用,外部使用时必须给出类的全名
B.可以使用它所在类的静态成员变量或实例成员变量,但不可以使用所在类中的局部变量
C.可以作为其它类的成员,而且可访问它所在类的成员
D.除static内部类外,不能在类内声明static成员


169.switch语句( A)
A.都可以用if-else if结构实现

B.都不可以用if-else if结构实现

C.有的可以用if-else if结构实现

D.大部分不可以用if-else if结构实现

170.JAVA程序经常用到“递归”,“递归”的基本思想是(C )
A.“让别人反复调用自己”        

B.“自己反复调用别人”

C.“自己反复调用自己”         

D.以上说法都不对


171.下面是一个递归JAVA程序,其功能为( C)

long Factorial(int n){
if(1==n){
return 1;
}
else
return n*Factorial(n-1);
}
A.求1-n的和              B.求2到n的和
C.求n的阶乘              D.求2-n的积


173.下列语句片段:
int result;
int a=17,b=6;
result=(a%b>4)? a%b:a/b System,out.println(result);
的结果为( D)
A.0                 B.1
C.2                 D.5


174.Java中访问限定符不包括(D )
A.public              

B.private

C.default              

D.final

原文地址:https://www.cnblogs.com/strong-FE/p/15419710.html