JAVA试题英文版.doc

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

一. Which two demonstrate an“is a” relationship? (Choose Two)

A. public interface Person { }public interface Shape { }public interface Color { } public class Species { }

public class Animal{private Species species;}

E. interface Component { }

Class Container implements Component (

Private Component[ ] children;

二.which statement is true?

A. An anonymous inner class may be declared as final

B.

An anonymous inner class can be declared as private

C. An anonymous inner class can implement mutiple interfaces

D. An anonymous inner class can access final variables in any enclosing scope (不能)

E. Construction of an instance of a static inner class requires an instance of the encloing outer class

构造一个静态的内部类对象需要构造包含它的外部类的对象

三 . Given:

1. package foo;

2.

3. public class Outer (

4. public static class Inner (

5. )

6. )

Which statement is true?

A. An instance of the Inner class can be constructed with “new () ”

B. An instance of the inner class cannot be constructed outside of package foo

他们都是 public 的,只要在外部 import 就行

C. An instance of the inner class can only be constructed from within the outer class

D. From within the package bar, an instance of the inner class can be constructed with “new inner() ”

四.Exhibit (展览、陈列):

1 public class enclosinggone{

2 public class insideone{}

3}

4public class inertest{

5public static void main (String[] args){

6enclosingone eo = new enclosingone();

7 InsideOne ei = InsideOne();写程序试出来

B. ei = InsideOne();

C InsideOne ei = InsideOne();

InsideOne ei = InsideOne();

五.

1)interface Foo{

2) int k=0;

3) }

4) public class Test implements Foo{

5) public static void main(String args[]){

6) int i;

7) Test test =new Test();

8) i=;

9) i=;

10) i=;

11) }

12) }

What is the result?

A. Compilation succeeds.

B. An error at line 2 causes compilation to fail.

C. An error at line 9 causes compilation to fail.

D. An error at line 10 causes compilation to fail.

E. An error at line 11 causes compilation to fail.

六.

B.default

C.implement

D.import

八. which three are valid declaraction of a float?

( float作为整数是可以的,其余几个都是double )

A. float foo=-1;

B. float foo=;

C. float foo=42e1;

D. float foo=;

E. float foo=;

F. float foo=0x0123;

九 . Given:

8. int index = 1;

9. boolean[] test = new boolean[3]; (数组作为对象缺省初始化为false )

10. boolean foo= test [index];

What is the result?

A. foo has the value of 0

B. foo has the value of null

C. foo has the value of true

D. foo has the value of false

E. an exception is thrown

F. the code will not compile

十. Given:

1.public class test(

2.public static void main(String[]args){

3.String foo = args [1];

4.String foo = args [2];

5.String foo = args [3];

相关文档
最新文档