相关考题

单项选择题 ClassOne.javapackagecom.abc.pkg1;publicclassClassOne{privatecharvar=‘a‘;chargetVar(){returnvar;}}ClassTest.javapackagecom.abc.pkg2;importcom.abc.pkg1.ClassOne;publicclassClassTestextendsClassOne{publicstaticvoidmain(Stringargs){chara=newClassOne().getVar();charb=newClassTest().getVar();}}Whatistheresult?()A.Compilationwillfail.B.Compilationsucceedsandnoexceptionsarethrown.C.Compilationsucceedsbutanexceptionisthrownatline5inClassTest.java.D.Compilationsucceedsbutanexceptionisthrownatline6inClassTest.java.

单项选择题 Youwanttolimitaccesstoamethodofapublicclasstomembersofthesameclass.Whichaccessmodifieraccomplishesthisobjective?()

单项选择题 importjava.io.IOException;publicclassExceptionTest(publicstaticvoidmain(Stringargs)try(methodA();)catch(IOExceptione)(system.out.printIn(CaughtIOException”);)catch(Exceptione)(system.out.printIn(CaughtException”);))publicvoidmethodA(){thrownewIOException();}Whatistheresult?()A.Thecodewillnotcompile.B.Theoutputiscaughtexception.C.TheoutputiscaughtIOException.D.Theprogramexecutesnormallywithoutprintingamessage.

单项选择题 abstractclassabstrctIt{abstractfloatgetFloat();}publicclassAbstractTestextendsAbstractIt{privatefloatf1=1.0f;privatefloatgetFloat(){returnf1;}}Whatistheresult?()

单项选择题 intindex=1;intfoo=newint;intbar=foo[index];intbaz=bar+index;Whatistheresult?()

单项选择题 YouareassignedthetaskofbuildingapanelcontainingaTextAreaatthetop,alabeldirectlybelowit,andabuttondirectlybelowthelabel.Ifthethreecomponentsareaddeddirectlytothepanel.WhichlayoutmanagercanthepanelusetoensurethattheTextAreaabsorbsallofthefreeverticalspacewhenthepanelisresized?()A.GridLayout.B.CardLayout.C.FlowLayout.D.BorderLayout.E.GridBagLayout.

单项选择题 publicclassIfTest(publicstaticvoidmain(stringargs){intx=3;inty=1;if(x=y)system.out.printIn(Notequal”);elsesystem.out.printIn(Equal”);})Whatistheresult?()

单项选择题 Youneedtostoreelementsinacollectionthatguaranteesthatnoduplicatesarestoredandallelementscanbeaccessedinnaturalorder.Whichinterfaceprovidesthatcapability?()

单项选择题 Thefilefile.txt”existsonthefilesystemandcontsinsASCIItext.Given:try{Filef=newFile(file.txt”);OutputStreamout=newFileOutputStream(f,true);}catch(IOException){}Whatistheresult?()

判断题 目前华为5G在Sub6G上能达到的最高频谱利用率为98.28%。()

单项选择题 WhichcanbeusedtoencodecharSforoutput?()

单项选择题 Whichgetsthenameoftheparentdirectoryfile“file.txt”?()

多项选择题 5G支持全频谱接入,()频段均可用于5G。

单项选择题 interfaceBeta{}classAlphaimplementsBeta{StringtestIt(){returnTested”;}}publicclassMain1{staticBetagetIt(){returnnewAlpha();}publicstaticvoidmain(String[]args){Betab=getIt();System.out.println(b.testIt());}}Whatistheresult?()A.TestedB.Compilationfails.C.Thecoderunswithnooutput.D.Anexceptionisthrownatruntime.

单项选择题 publicclassOuter{2.publicvoidsomeOuterMethod(){3.//Line34.}5.publicclassInner{}6.publicstaticvoidmain(String[]argv){7.Outero=newOuter();8.//Line89. }10. }WhichinstantiatesaninstanceofInner?()

单项选择题 20.publicfloatgetSalary(Employeee){21.assertvalidEmployee(e);22.floatsal=lookupSalary(e);23.assert(sal>0);24.returnsal;25.}26.privateintgetAge(Employeee){27.assertvalidEmployee(e);28.intage=lookupAge(e);29.assert(age>0);30.returnage;31.}Whichlineisaviolationofappropriateuseoftheassertionmechanism?()A.line21B.line23C.line27D.line29

单项选择题 Whichfragmentisanexampleofinappropriateuseofassertions?()

单项选择题 inti=1,j=10;do{if(i>j){continue;}j--;}while(++i<6);System.out.println(i=+i+”andj=+j);Whatistheresult?()

单项选择题 publicclassA{2.voidA(){3.System.out.println(ClassA”);4.}5.publicstaticvoidmain(String[]args){6.newA();7.}8.}Whatistheresult?()

单项选择题 inti=0;while(true){if(i==4){break;}++i;}System.out.println(i=”+i);Whatistheresult?()