JAVA试题英文版

JAVA试题英文版


2024年4月2日发(作者:)

—• Wh i ch two demonstrate an "is a” re I ationship? (Choose Two)

A. pub Iic interface Person { )pub Iic interface Shape { )pub Iic interface Color { Jpubl

ic cI ass Species { }

pub Iic class Animal{pr ivate Species species;)

E. interface Component { }

CI ass Container imp I ements Component (

Pr i vate Component[ ] children;

.wh i ch stat emen t i: s true?

A. An

B. An

anonymous i nner c I ass may

anonymous i nner class can

be dec Iared

as final

be declared as pr ivate

enclosing

C. An anonymous i nner class can

impIement mut i pIe i nterfaces

D. An

anonymous

i nner class can access final var iables in any

scope

(不能)

E. Cons true t i on of an i nst ance of a stat i c i nner c I ass requ i res an i nst

ance of the encIoing outer cI ass

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

类的对象

三.

G i ven:

package foo;

2.

3. public class Outer (

4.

5.

6. )

Which statement is true?

A. An instance of the Inner cI ass can be construeted with "new ()

n

B. An instance of the i nner c I ass cannot be cons true ted out s i de of package foo

publ ic static class Inner (

)

他们都是

publ ic

的,只要在外部

import

就行

C・ An instance of the inner c I ass can only be cons trucked from wit h i n the outer cI

ass

D. From with i n the package bar, an i nstance of the i nner cI ass can be constructed

with "new inner ()

n

(展览、陈列):

Exhibit.

1 publ ic cI ass encI osinggone {

2 public cI ass insideone{)

3 )

4 public class inertest{

5 public static void main (Str ing[] args) {

6 encI os i ngone eo = new encI os i ngone ();

7 I ns i deOne e i = I ns i deOne 0 ;

写程序试出来

B. e i = I ns i deOne ():

C InsideOne e i = InsideOne();

I ns i deOne e i = I ns i deOne ();

五.

1) interface Foo{ cI ass Test imp I ements Foo {

2)

3)

c

5)

6)

7)

=new Test ();

8)

9)

10)

11)

What is the result?

A. Comp i I ation succeeds.

B. An error at I i

2

causes

ne

c. An error at

I i

9 causes

ne

D. An error

at

I i

10

causes

I i

11 causes E. An error at

ne

ne

comp i I ation to fail.

comp i I ation to fail.

comp i I ation to fail.

comp i I ation to fail.

1

pub I ic static void ma i n (Stri ng args[]) { int i ;

Test test

4) pub I i

B. defau 11

C. imp I ement

D. impor t

八.

wh i ch three are valid dec Iaraction of a fIoat?

(float

作为整数是可以的,其余几个都是

double)

A. float foo T;

B. float foo

*

C. f I oat foo

42e1;

D. float foo

E. float foo

F. float foo

f

0x0123;

九.

Given:

8.

9.

i nt i ndex = 1 ;

boo I ean [] test = new boo I ean [3];

(数组作为对象缺省初始化为

fa I se)

10. boolean foo= test [index];

What i

J

> the resuIt?

A. foo has the va I ue of 0

B. foo has the va I ue of nu I

I

c.

foo has the va I ue of t rue

D. foo has the value

E・ an exception is thrown

of

fa I

s

F. the code wi I I not compi le

+

1.

pub I ic

cI ass test(

2.

pub I ic static void

3. Str i ng foo = args

4. Str i ng foo = args

5. Str i ng foo = args

6.)

7. 1

Given:

main(Str ing[]args) {

[1];

⑵;

[3];

And the command Iine invocation:

Java Test

What i > the resuIt?

i

J

of

A.

baz has the va I ue

B.

baz has the va I ue of nu I I

c.

baz has the

va

I ue of

D.

baz has the va I ue of

E.

bax has the va I ue of

“red”

“blue”

green

com pile

F.

the code does not

G.

the program thi rows an except i on

(此题题目出错了,重复定义了变量

f

。。,如果没有重复的话,应选

G,

因为只传 递

0-2

三个数组元素,而题目中需要访问

args [3],

所以会抛出数组越界异 常)

H•

int indexh;

int foo[]=new int[3]:

int bar=foo[index]; baz has a value of 0

B. baz has vaIue of 1

C. baz has vaIue of 2

D. an exception is thrown

E. the code wi I I not compi Ie

十二.

1) pub Iic class Foo {

2) pub I ic static void ma i n (Stri ng args[]) {

3) Str ing s;


发布者:admin,转转请注明出处:http://www.yc00.com/web/1712043012a1995605.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信