2025年Java程序员认证真题集锦_第1页
2025年Java程序员认证真题集锦_第2页
2025年Java程序员认证真题集锦_第3页
2025年Java程序员认证真题集锦_第4页
2025年Java程序员认证真题集锦_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

yModule1-JAVA基础

一、选择题:

Question1

Given:

35.String#name=HJaneDoe";

36.int$age=24;

37.Double_height=123.5;

38.double-temp=37.5;

Whichtwoaretrue?(Choosetwo.)

A.Line35willnotcompile.

B.Line36willnotcompile.

C.Line37willnotcompile.

D.Line38willnotcompile.

Answer:AD标识符以字母,下划线,或者$开始

Question2

Given:

11.publicclassTest{

12.publicstaticvoidmain(String[]args){

13.intx=5;

14.booleanbl=true;

15.booleanb2=false;

16.

17.if((x==4)&&!b2)

18.Systern.out.print("1");

19.System.out.print("2");

20.if((b2=true)&&bl)

21.System.out.print("3");

22.)

23.)

Whatistheresult?

A.2

B.3

C.12

D.23

E.123

F.Compilationfails.

G.Anexceptionalisthrownatruntime.

Answer:D注意20行,=为赋值,不要受骗

Question3

Given:

42.publicclassClassA{

43.publicintgetValue(){

44.intvalue=0;

45.booleansetting=true;

46.String;

47.if(value||(setting&&title=="Hello")){return1;}

48.if(value==1&title.equals(nHellon)){return2;}

49.)

50.}

And:

70.ClassAa=newClassA();

71.a.getValue();

Whatistheresult?

A.1

B.2

C.Compilationfails.

D.Thecoderunswithnooutput.

E.Anexceptionisthrownatruntime.

Answer:C编译不通过,47行value为int类型不是boolean

Question4

Given:

11.publicvoidtestlfAO{

12.if(testIfB("True")){

13.System.out.printin("True");

14.}else{

15.System.out.printin("Nottrue");

16.)

17.}

18.publicBooleantestlfB(Stringstr){

19.returnBoolean.valueOf(str);

20.)

WhatistheresultwhenmethodtestlfAisinvoked?

A.True

B.Nottrue

C.Anexceptionisthrownatruntime.

D.Compilationfailsbecauseofanerroratline12.

E.Compilationfailsbecauseofanerroratline19.

Answer:A19行,假如str为true贝返回ture,否贝lj返回false

Question5

Given:

11.publicstaticvoidmain(String[]args){

12.Integeri=newInteger(1)+newInteger(2);

13.switch(i){

14.case3:System.out.printin("three");break;

15.default:System.out.println("other");break;

16.)

17.)

Whatistheresult?

A.three

B.other

C.Anexceptionisthrownatruntime.

D.Compilationfailsbecauseofanerroronline12.

E.Compilationfailsbecauseofanerroronline13.

F.Compilationfailsbecauseofanerroronline15.

Answer:A就是两个工nteger类型相加

Question6

Given:

11.publicstaticvoidmain(String[]args){

12.Stringstr="null";

13.if(str==null){

14.System.out.printin("null");

15.}else(str.length()=0){

16.System.out.printin("zero");

17.}else{

18.System.out.printin{*'some");

19.)

20.)

'Whatistheresult?

A.null

B.zero

C.some

D.Compilationfails.

E.Anexceptionisthrownatruntime.

Answer:D这题真恶心15行少个if

Question7

Given:

10.intx=0;

ll.inty=10;

12.do{

13.y--;

14.++x;

15.}while(x<5);

16.System.out.print(x+","+y);

Whatistheresult?

A.5,6

B.5,5

C.6Z5

D.6,6

Answer:B(91,82,73,64,55)没啥争议

Question8

Given:

25.intx=12;

26.while(x<10){

27.x—;

28.}

29.System.out.print(x);

Whatistheresult?

A.0

B.10

C.12

D.Line29willneverbereached.

Answer:C12>10,因此直接跳出循环,输出x=12

Question9

Given:

35.intx=10;

36.do{

37.x--;

38.}while(x<10);

Howmanytimeswillline37beexecuted?

A.tentimes

B.zerotimes

C.onetometimes

D.morethantentimes

Answer:D死循环

Question10

Given:

11.publicstaticvoidmain(String[]args){

12.for(inti=0;i<=10;i++){

13.if(i>6)break;

14.)

15.System.out.printin{i);

16.)

Whatistheresult?

A.6

B.7

C.10

D.11

E.Compilationfails.

F.Anexceptionisthrownatruntime.

Answer:E15行i超过了作用域

Question11

Given:

55.int[]x={1,2,3,4,5};

56.inty[]=x;

57.System.out.println(y[2]);

Whichistrue?

A.Line57willprintthevalue2.

B.Line57willprintthevalue3.

C.Compilationwillfailbecauseofanerrorinline55.

D.Compilationwillfailbecauseofanerrorinline56.

Answer:B没争议,考察数组下标是从0开始

Question12

Whichtwocodefragments(片段)correctly(对的)createandinitialize

astaticarrayofintelements?(Choosetwo.)

A.staticfinalint[]a={100,200);

B.staticfinalint[]a;

static{a=newint[2];a[0]=100;a[1]=200;}

C.staticfinalint[]a=newint[2]{100,200};

D.staticfinalint[]a;

staticvoidinit(){a=newint[3];a[0]=100;a[l]=200;}

Answer:ABc不能指定长度,d不能在init措施中赋值,要么在static代码块中

Question13

Given:

11.publicstaticvoidmain(String[]args){

12.Objectobj=newint[]{1,2,3);

13.int[]someArray={int[])obj;

14.for(inti:someArray)System.out.print(i+"*')

15.)

'Whatistheresult?

A.123

R.Compi1ationfailscfanArrorin1i12.

C.Compilationfailsbecauseofanerrorinline13.

D.Compilationfailsbecauseofanerrorinline14.

E.AClassCastExceptionisthrownatruntime.

Answer:A没争议,foeach循环遍历数组

Question14

Given:

11.String[]elements={"for","tea",ntoo");

12.Stringfirst=(elements.length>0)?elements[0]:null;

Whatistheresult?

A.Compilationfails.

B.Anexceptionisthrownatruntime.

C.Thevariablefirstissettonull.

D.Thevariablefirstissettoelements[0].

Answer:D

Question15

Given:

10.publicclassBar{

11.staticvoidfoo(int...x){

12.//insertcodehere

13.)

14.)

Whichtwocodefragments,insertedindependently(独立的)atline12,will

allowtheclasstocompile?(Choosetwo.)

A.foreach(x)System.out.printin(z);

B.for(intz:x)System.out.println(z);

C.while(x.hasNext())System.out.printin(x.next());

D.for(inti=0;i<x.length;i++)System.out.printin(x[i]);

Answer:BDx相称于一种数组,a明显错没有foreach,c中x没有hadNext措施

Question16

Aprogrammer(程序员)needstocreatealoggingmethodthatcanaccept

(接受)anarbitrary(随意任意)numberofarguments.Forexample,itmay

becalledinthese

logit("logmessage1");

logit("logmessage2","logmessage3n);

logit("logmessaged","logmessage5n,"logmessage6");

Whichdeclaration(阐明)Gaticfico(符合)thiorequirement(需求)?

A.publicvoidlogit(String*msgs)

B.publicvoidlogit(String[]msgs)

C.publicvoidlogit(String...msgs)

D.publicvoidlogit(Stringmsgl,Stringmsg2zStringmsg3)

Answer:C可变长参数

Question17

1publicclassA{

2publicStringdoit(intx,inty)

3return"a";

4}

5

6publicSLxlngdolt(inL...vdls)

7return"b";

0.1

9.}

Given:

25.Aa=newA();

26.System.out.printin{a.doit(4,5));

Whatistheresult?

A.Line26prints"a"toSystem.out.

B.Line26prints"b"toSystem.out.

C.Anexceptionisthrownatline26atruntime.

D.CompilationofclassAwillfailduetoanerrorinline6.

Answer:A确定参数和可变长参数同步存在的时候,优先考虑确定参数的

Question18

Givena:

1.packageanimals.mammals;

2.

3.publicclassGrizzlyBearextendsBear{

4.voidhunt(){

5.Salmons=findSalmon();

6.s.consume();

7-}

8.}

andanotherfile,Salmon.java:

1.packageanimals.fish;

2.

3.publicclassSalmonextendsFish{

4.voidconsume(){/*dostuff*/)

5.)

Assume(假定)bothclassesaredefinedinthecorrectdirectoriesfortheft

packages,andthattheMammalclasscorrectlydefinesthefindSalmon()

method.Whichtwochangesallowthiscodetocompilecorrectly?(Choose

two.)

A.addpublictothestartofline4inSalmon.java

B.addpublictothestartofline4inGrizzlyBear.java

C.addimportanimals.mammals.*;atline2inSalmon.java

D.addimportanimals.fish.*;atline2inGrizzlyBear.java

E.addimportanimals.fish.Salmon.*;atline2inGrizzlyBear.java

F.addimportanimals.mammals.GrizzlyBear.*;atline2inSalmon.java

Answer:AD调用不一样包下的类,要先导入,措施权限要设置成public

Question19

Given:

10.packagecom.sun.scjp;

11.publicclassGeodetics{

12.publicstaticfinaldoubleDIAMETER=12756.32;//kilometers

13.)

Whichtwocorrectlyaccess(访问)theDIAMETERmemberoftheGeodeticsclass?

(Choosetwo.)

A.importcom.sun.scjp.Geodetics;

publicclassTerraCarta{

publicdoublehalfway()

{returnGeodetics.DIAMETER/2.0;}}

B.importstaticcom.sun.scjp.Geodetics;

publicclassTerraCarta(

publicdoublehalfway(){returnDIAMETER/2.0;}}

C.importstaticcom.sun.scjp.Geodetics.*;

publicclassTerraCarta{

publicdoublehalfway(){returnDIAMETER/2.0;}}

D.packagecom.sun.scjp;

publicclassTerraCarta{

publicdoublehalfway(){returnDIAMETER/2.0;}}

Answer:ACb中不能静态导入类,c中静态导入类属性,对的,d访问错误很明显

Question20

Givenclassesdefinedintwodifferentfiles:

1.packageutil;

2.publicclassBitutils{

3.privatestaticvoidprocess(byte[]b){}

4.}

1.packageapp;

2.publicclassSomeApp{

3.publicstaticvoidmain(String[]args){

4.byte[]bytes=newbyte[256];

5.//insertcodehere

6.}

7.}

Whatisrequired(必需的)atline5inclassSomeApptousetheprocess

method

ofBitUtils?

A.process(bytes);

B.BitUcess(bytes);

C.app.BitUcess(bytes);

D.util.BitUcess(bytes);

E.importutil.BitUtils.*;process(bytes);

F.SomeAppcannotusetheprocessmethodinBitUtils.

Answer:F私有的,不能被访问

Question21

GivenaclassRepetition(反复):

1.packageutils;

2.

3.publicclassRepetition{

4.publicstaticStringtwice(Strings){returns+s;}

5.)

andgivenanotherclassDemo:

1.//insertcodehere

2.

3.publicclassDemo{

4.publicstaticvoidmain(String[]args){

5.System.out.printin(twice("pizza"));

6.)

7.}

Whichcodeshouldbeinsertedatline1ofDemo.javatocompileandrun

Demotoprint''pizzapizza''?

A.importutils.*;

B.staticimportutils.*;

C.importutils.Repetition.*;

D.Staticimportutils.Repetition.*;

E.importutils.Repetition.twice();

F.importstaticutils.Repetition.twice;

G.staticimportutils.Repetition.twice;

Answer:F静态导入

Question22

Given:

1.packagetest;

2.

3.classTarget(目的){

4.publicStringname="hello";

5.}

Whatcandirectly(直接的)accessandchangethevalueofthevariable

(变量)name?

A.anyclass

B.onlytheTargetclass

C.anyclassinthetestpackage

D.anyclassthatextendsTarget

Answer:Cdefault类型的类本包访问权限

Question23

Given:

11.rbo=newReallyBigObject();

12.//morecode

13.rbo=null;

14./*insertcodehere*/

Whichstatement(语句)shouldbeplacedatline14tosuggest(促成)that

thevirtualmachine(虚拟机)expend(消耗)effort(努力)towardrecycling

(回收)thememoryusedbytheobjectrbo?

A.System.gc();

B.Runtime.gc();

C.System.freeMemory();

D.Runtime.getRuntime().growHeap();

E.Runtime.getRuntime().freeMemory();

Answer:A题很简朴。英语单词很烦

Question24

Given:

11.classSnoochy{

12.Boochybooch;

13.publicSnoochy(){booch=newBoochy(this);}

14.)

15.

16.classBoochy{

17.Snoochysnooch;

18.publicBoochy(Snoochys){snooch=s;}

19.)

Andthestatements:

21.publicstaticvoidmain(String[]args){

22.Snoochysnoog=newSnoochy();

23.snoog=null;

24.//morecodehere

25.)

Whichstatementistrueabouttheobjectsreferenced(弓|用)bysnoog,snooch,

andboochimmediately(即亥!!)afterline23executes?

A.Noneoftheseobjectsareeligibleforgarbagecollection(垃圾搜集).

B.Onlytheobjectreferencedbyboochiseligibleforgarbage

collection.

C.Onlytheobjectreferencedbysnoogiseligibleforgarbage

collection.

D.Onlytheobjectreferencedbysnoochiseligibleforgarbage

collection.

E.Theobjectsreferencedbysnoochandboochareeligible(符合)for

garbagecollection.

Answer:Esnoog-x—snooch和booch,因此s和b应当被回收掉

Question25

Given:

1.publicclassGC{

2.privateObjecto;

3.privatevoiddoSomethingElse(Objectobj){o=obj;}

4.publicvoiddoSomething(){

5.Objecto=newObject();

6.doSomethingElse(o);

7.o=newObject();

8.doSomethingElse(null);

9.o=nul1;

10.)

11.)

WhenthedoSomethingmethodiscalled,afterwhichlinedoestheObject

createdinline5becomeavailableforgarbagecollection?

A.Line5

B.Line6

C.Line7

D.Line8

E.Line9

F.Line10

Answer:D第二个new不会new新对象,而还是此前的,只是第8行的时候,o才无效!

Question26

Given:

11.publicvoidgenNumbers(){

12.ArrayListnumbers=newArrayList();

13.for(inti=0;i<10;i++){

14.intvalue=i*((int)Math.random());

15.IntegerintObj=newInteger(value);

16.numbers.add(intObj);

17.}

18.System.out.printin{numbers);

19.)

Whichlineofcodemarks(标志)theearliestpointthatanobjectreferenced

byintObjbecomesacandidate(替补)forgarbagecollection?

A.Line16

B.Line17

C.Line10

D.Line19

E.TheobjectisNOTacandidateforgarbagecollection.

Answer:D措施结束后变量失效,表达可以被回收了

Question27

Whichtwoaretrue?(Choosetwo.)

A.AfinalizermayNOTbeinvokedexplicitly(直接).

B.ThefinalizemethoddeclaredinclassObjecttakesnoaction.

C.super.finalize()iscalledimplicitly(byanyoverridingfinalize

method.

D.Thefinalizemethodforagivenobjectwillbecallednomorethan

oncebythegarbagecollector.

E.Theorderinwhichfinalizewillbecalledontwoobjectsisbased

ontheorderinwhichthetwoobjectsbecamefinalizable.

Answer:BD稀里糊涂

Question28

Given:

15.publicclassYippee{

16.publicstaticvoidmain(String[]args){

17.for(intx=1;x<args.length;x++){

18.System,out.print(args[x]+"*');

19.)

20.}

21.}

andtwoseparatecommandlineinvocations(两个犯立的命令行执行):

javaYippee

javaYippee1234

Whatistheresult?

A.Nooutputisproduced(生产).

123

B.Nooutputisproduced.

234

C.Nooutputisproduced.

1234

D.Anexceptionisthrownatruntime.

CopyrightTarenaCorporation,.Allrightsreserved

123

E.Anexceptionisthrownatruntime.

234

F.Anexceptionisthrownatrijntime.

1234

Answer:B第一种没有参数不输出,第二个从数组下标为1的地方输出

Question29

Givenacorrectlycompiledclasswhosesourcecodeis:

1.packagecom.sun.sjcp;

2.publicclassCommander{

3.publicstaticvoidmain(String[]args){

4.//morecodehere

5.)

6.}

Assumethattheclasslocated(位于)in/foo/com/sun/sjcp/,thecurrent

directoryis/foo/,andthattheclasspathcontains''.''(current

directory).WhichcommandlinecorrectlyrunsCommander?

A.javaCommander

B.javacom.sim.sjcp.Commander

C.javacom/sun/sjcp/Commander

D.java-cpcom.sun.sjcpCommander

E.java-cpcom/sun/sjcpCommander

Answer:B

Question30

Given:

11.publicclassCommander{

12.publicstaticvoidmain(String[]args){

13.StringmyProp=/*insertcodehere*/

14.System.out.printin(myProp);

15.)

16.)

andthecommandline:

java-Dprop.custom=gobstopperCommander

Whichtwo,placedonline13,willproducetheoutputgobstopper?

(Choosetwo.)

A.System.load("prop.custom");

B.System.getenv("prop.custom");

C.Sperty("prop.custom");

D.System.getProperty("prop.custom");

E.System.getProperties().getProperty("prop.custom");

Answer:DE没接触过,硬背吧,从命令行获得属性

Question31

Aclassgames.cards.Pokeriscorrectlydefinedinthejar.

AuserwantstoexecutethemainmethodofPokeronaUNIXsystem

usingthecommand:javagames.cards.Poker

Whatallowstheusertodothis?

A.putPoker.jarindirectory/stuff/java,andsettheCLASSPATHto

include/stuff/java

B.putPoker.jarindirectory/stuff/java,andsettheCLASSPATHto

include/stuff/java/*.jar

C.PutPoker.jarindirectory/stuff/java,andsettheCLASSPATHto

include/stuff/java/Poker.jar

D.putPoker.jarindirectory/stuff/java/games/cards,andsetthe

CLASSPATHtoinclude/stuff/java

E.putPoker.jarindirectory/stuff/java/games/cards,andsetthe

CLASSPATHtoinclude/stuffijava/*.jar

F.putPoker.jarindirectory/stuff/java/games/cards,andsetthe

CLASSPATHtoinclude/stuff/java/Poker.jar

Answer:C没接触过,意思就是将jar包放入classpath,可以直接被执行,不过包的目

录层次还是要体现出来的,死记硬背吧

Question32

JarAJarBJarC

0META-INF

已can

LJcomL口com

L-eiioo

L

L&bartoo

LObar

-gDog.ciass

-gDogclass

-同Carclass

匚口btatz

Bookclass

WatzL同Bookclass

-回Bookclass

L同Carclass一□bar

-回Sun.dass

L?MatzL国Carciass

L回Sun出$$Lblatz

L国Sinciass

JarE

JarD

已META-INF

国Dogclass同Bookciass

-同Dogclass

gSunclass同Cardass

Book.ctaw

-gearclaw

国Sundays

Giventhefully-qualified(完全合格)classnames:

com.foo.bar.Dog

com.foo.bar.blatz.Book

com.bar.Car

com.bar.blatz.Sun

Whichgraph(图)represents(表达)thecorrectdirectorystructure(构

造)foraJARwhichthoseclassescanbeusedbythecompilerandJYM?

A.JarA

B.JarB

C.JarC

D.JarD

E.JarE

Answer:A无争议就是A

Question33

AdeveloperiscreatingaclassBookthatneedstoaccessclassPaper.

ThePaperclassisdeployedinaJARnamedmyLib.jar.Whichthree,

takenindependently(独立的),willallowthedevelopertousethePaper

class

whilecompilingtheBookclass?

(Choosethree.)

A.TheJARlocatedat$JAVA_HOME/jre/classes/myLib.jar.

B.TheJARlocatedat$JAVA_HOME/jre/lib/ext/myLib.jar.

C.TheJARlocatedat/foo/myLib.jarandaclasspath

Environmentvariableissetthatincludes/foo/myLib.jar/Paper.class.

D.TheJARlocatedat/foo/myLib.jarandaclasspath

environment(环境)variableissetthatincludes/foo/myLib.jar.

E.TheJARlocatedat/foo/myLib.jarandtheBookclassis

compiledusingjavac-cp/£oo/myLib.jar/PaperBook.java.

F.TheJARlocatedat/foo/myLib.jarandtheBookclassis

compiledusingjavac-d/foo/myLib.jarBook.java.

G.TheJARlocatedat/foo/myLib.jarandtheBookclassis

compiledusingjavac-classpath/foo/myLib.jarBook.java.

Answer:BDG

Question34

Given:

1.packagepany.application;

2.

3.publicclassMainClass{

4.publicstaticvoidmain(String[]args){}

5.}

AndMainClassexistsinthe/apps/com/company/applicationdirectory.

AssumetheCLASSPATHenvironmentvariableissetto(current

directory).Whichtwojavacommandsentered(输入)atthecommandline

willrunMainClass?

(Choosetwo.)

A.javaMainClassifrunfromthe/appsdirectory

B.javapany.application.MainClassifrunfromthe/apps

directory

C.java-classpath/appspany.application.MainClassifrun

fromanydirectory

D.java-classpath.MainClassifrunfromthe

/apps/com/company/applicationdirectory

E.java-classpath/apps/com/company/application:.MainClassIfrun

fromthe/appsdirectory

F.javacom.con^>any.application.MainClassifrunfromthe

/apps/com/company/applicationdirectory

Answer:BC无争议

Question35

AUNIXusernamedBobwantstoreplace(替代)hischessprogramwitha

newone,butheisnotsurewheretheoldoneisinstalled.Bobis

currentlyabletorunaJavachessprogramstartingfromhishome

directory/home/bobusingthecommand:

java-classpath/test:/home/bob/downloads/*.jargames.Chess

Bob'sCLASSPATHisset(atlogintime)to:

/usr/lib:/home/bob/classes:/opt/java/lib:/opt/java/lib/*.jar

WhatisapossiblelocationfortheChess.classfile?

A./test/Chess.class

B./home/bob/Chess.class

C./test/games/Chess.class

D./usr/lib/games/Chess.class

E./home/bob/games/Chess.class

F.insidejar(withacorrectmanifest)

G.insidejar(withacorrect

manifest)

Answer:C考察执行时的包层次,尚有就是执行jar中类的时候,要指明jar包名,不能用

*.jar

Question36

Given;

11.publicclassCounter{

12.publicstaticvoidmain(String[]args){

13.intnumArgs=/*insertcodehere*/;

14.)

15.)

andthecommandline:

javaCounteronefred42

Whichcode,insertedatline13,captures(截获)thenumberofarguments

passedintotheprogram?

A.args.count

B.args.length

C.args.count()

D.args.length()

E.args.getLength()

Answer:B截获的是参数的长度,数组用args.length,没有length()

Question37

Given:

12.publicclassYippee2{

13.

14.staticpublicvoidmain(String[]yahoo){可以颠倒

15.for(intx=1;x<yahoo.length;x++){

16.System.out.print(yahoo[x]+"");

17.)

18.}

19.)

andthecommandlineinvocation:

javaYippee2abc

Whatistheresult?

A.ab

B.bc

C.abc

D.Compilationfails.

E.Anexceptionisthrownatruntime.

Answer:B没争议,之前有过类似题

Question38

1.publicclassTest{

2.intx=12;

3.publicvoidmethod(intx){

4.x+=x;

5.System.out.printin(x);

6.)

7.}

Given:

34.Testt=newTest();

35.t.method(5);

Whatistheoutputfromline5oftheTestclass?

A.5

B.10

C.12

D.17

E.24

Answer:B没指定七his,用的都是形参中的,5+5=10,因此选b

Question39

GiventhecommandlinejavaPass2and:

15.publicclassPass2{

16.publicvoidmain(String[]args){

17.intx=6;

18.Pass2p=newPass2();

19.p.doStuff(x);

20.System.out.print("mainx="+x);

21.}

22.

23.voiddoStuff(intx){

24.System.out.print("doStuffx="+x++);

25.)

26.)

Whatistheresult?

A.Compilationfails.

B.Anexceptionisthrownatruntime.

C.doStuffx=6mainx=6

D.doStuffx=6mainx=7

E.doStuffx=7mainx=6

F.doStuffx=7mainx=7

Answer:B垃圾题,草他大爷,主函数没有static关键字

Question40

12.Given:

13.publicclassPass{

14.publicstaticvoidmain(String[]args){

15.intx=5;

16.Passp=newPass();

17.p.doStuff(x);

18.System.out.print("mainx="+x);

19.)

20.

21.voiddoStuff(intx){

22.System.out.print("doStuffx="+x++);

23.)

24.)

Whatistheresult?

A.Compilationfails.

B.Anexceptionisthrownatruntime.

C.doStuffx=6mainx=6

D.doStuffx=5mainx=5

E.doStuffx=5mainx=6

F.doStuffx=6mainx=5

Answer:D他大爷的,和上题同样的,就是加上了个static,还5改了个x的初始值,

上题为6,此题为5,藐视!

Question41

22.publicvoidgo(){

23.Stringo="

24.z:

25.for(intx=0;x<3;x++){

26.for(inty=0;y<2;y++){

27.if(x==1)break;

28.if(x==2&&y==l)breakz;

29.o=o+x+y;

30.}

31.)

32.System.out.printin(o);

33.}

Whatistheresultwhenthego()methodisinvoked?

A.00

B.0001

C.000120

D.0001

E.Com

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论