JAVA试题英文版(答案)

别妄想泡我
807次浏览
2021年01月31日 17:56
最佳经验
本文由作者推荐

迷茫的爱歌词-十二属相图片

2021年1月31日发(作者:火树银花什么意思)

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


A. public interface Person { }
//
语法错了

public class Employee extends Person { }


B. public interface Shape { }
//
语法错了

public class Employee extends Sha pe { }
C. public interface Color { }
//
语法错了

public class Employee extends Color { }
D. 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
1

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 }
4 public class inertest{
5 public static void main (String[] args){
6 enclosingone eo = new enclosingone();
7 //insert code here
8 }
}
Which statement at line 7 constructs an instance of the inner class?
A. InsideOne ei = InsideOne();
写程序试出来

B. One ei = InsideOne();
C InsideOne ei = InsideOne();
ingOne 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=test.k;


9)
i=Test.k;


10)
i=Foo.k;


11)
}


12) }


What is the result?


2

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.

六
.


//point X

public class Foo{

public static void main(String[] args){

PrintWriter out=new PrintWriter(new
StreamWriter(),true);

n(


}

}

which statement at point X on line 1 allows this code to compile and run?


在
point X
这个位置要填入什么代码才能使程序运行

riter

B.
include riter

StreamWriter
D.
include StreamWriter

statement is needed

本来两个都要
import
,但是后者
Ou tputStreamWriter
指定了包结构
StreamWriter

七
.

what is reserved words in java?

保留字而非关键字

A. run

B.

default


C. implement

D. import


八
.
which three are valid declaraction of a float?


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

A. float foo=-1;

B. float foo=1.0;

C. float foo=42e1;

3

D. float foo=2.02f;

E. float foo=3.03d;

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];
6. }
7. }

And the command line invocation:
Java Test


What is the result?


A. baz has the value of “”

B. baz has the value of null
C. baz has the value of “red”

D. baz has the value of “blue”

E. bax has the value of “green”

4

迷茫的爱歌词-十二属相图片


迷茫的爱歌词-十二属相图片


迷茫的爱歌词-十二属相图片


迷茫的爱歌词-十二属相图片


迷茫的爱歌词-十二属相图片


迷茫的爱歌词-十二属相图片


迷茫的爱歌词-十二属相图片


迷茫的爱歌词-十二属相图片