版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
QUESTION61GIVENTHEEXHIBIT:Whichstatementistrue?A.Alloftheassertstatementsareusedappropriately.B.Onlytheassertstatementonline31isusedappropriatelyC.Theassertstatementsonlines29and31areusedappropriatelyD.Theassertstatementsonlines26and29areusedappropriatelyE.Theassertstatementsonlines29and33areusedappropriatelyF.Theassertstatementsonlines29,31and33areusedappropriatelyG.Theassertstatementsonlines26,29and31areusedappropriately斷言應當用在“你以為”你程序不也許產生錯誤地方,并且有無啟用斷言,都不會影響程序正常運營。斷言使用限制:不要在public辦法中,用斷言來檢查參數(shù)對的性;不要讓斷言語句去解決某些程序必要流程。因素:1.public辦法會被別人調用,你不能保證她一定啟用斷言;如果沒有啟用,那么用斷言來做參數(shù)檢查也就沒故意義了。因此不要用斷言來檢查參數(shù),公共辦法參數(shù)一定要用代碼執(zhí)行檢查; 2.如果用斷言來控制程序執(zhí)行流程,如果沒有啟用斷言,那么程序就不能對的執(zhí)行下去。此外,斷言語句不可以有任何邊界效應,不要使用斷言語句去修變化量和變化辦法返回值,如果這樣當啟動斷言和不啟動斷言執(zhí)行成果會截然不同。斷言使用時機:檢查流程不變性:在if-elseswitch-case預期成果之外可以加上斷言做額外檢查。內部執(zhí)行不變性:if(true){return;}assertfalse;檢查私有辦法參數(shù),成果等程序運營中一致性斷言語句不是永遠會執(zhí)行,可以屏蔽也可以啟用
javac–source1.4*.java需要java–ea啟用assert;當判斷條件為FALSE時就拋出錯誤。Answer:(C)26行不適當:不要對public辦法參數(shù)斷言29適當:程序員在程序中最不大也許到達地方斷言
31適當:斷言private辦法參數(shù)
33行不適當:啟用和不啟用斷言會產生不同程序執(zhí)行序
參照大綱:異常解決—斷言和AssertionErrorQUESTION62GIVENTHEEXHIBIT:Whatistheresult?A. nullB. zeroC. someD. CompilationfailsE. AnexceptionisthrownatruntimeAnswer:(D)13行會報錯,應在15行使用elseif參照大綱:流程控制QUESTION63Giventheexhibit:Whatistheresult?A.testB.ExceptionC.CompilationfailsD.NullPointerExceptionAnswer:(C)18行出錯,應當先catch子異常,再catchException;13行把args賦null,14行會報NullPointerException如果沒有第13行運營時14行會報ArrayIndexOutOfBoundsException異常。參照大綱:異常解決QUESTION64Giventheexhibit:Whatistheresult?A.CompilationfailsB.aAaAaAaAAaaAaAC.AAaaAaAaAaaAaAD.AaAAAaaaAaAaAaE.aAaAaAaAaAAAaaF.AnexceptionisthrownatruntimeAnswer:(C)第10行將對strings這個集合做自然排序(ASCII小到大,一種一種比較)Collections.sort(Listlist)對list進行排序,對set不能排序!List里可以放對象,因此當list里面存儲是對象時候就不能用Collections.sort(Listlist)去排序了。由于JVM不懂得用什么規(guī)則去排序??!只有把對象類實現(xiàn)Comparable接口,然后改寫compareTo()參照大綱:集合QUESTION65Giventheexhibit:Whatistheresult?A.0B.1C.2D.3E.4F.Compilationfails.G.AnexceptionisthrownatruntimeAnswer:(D)Set中存儲元素是無序不重復。如果你想Set里Add一種元素,一方面她會去調用equals辦法,判斷set中與否有該元素,如果有則不更改set值并返回false,如果沒有,則把元素添加進去,并返回true。Ws1ws2是自定義類,ws1和ws2equals不相等;Stringequals辦法已經(jīng)改寫,s1和s2相等;比較兩個對象與否相似,先比較hashcode,如果相似,在用equals辦法比較.如果都相似則兩個對象就以為是相似.Hashcode是把對象內存地址通過運算得來.基本數(shù)據(jù)類型和基本數(shù)據(jù)類型包裝類尚有String類都已經(jīng)覆蓋了hashcode(),equals(),因此這些對象值只要同樣就以為對象同樣.參照大綱:集合QUESTION66Givenapre-genericsimplementationofamethod:Whichthreechangesmustbemadetothemethodsumtousegenerics?(choosethree)A.removeline14B.replaceline14with"inti=iter.next();"C.replaceline13with"for(inti:intList){"D.replaceline13with"for(Iteratoriter:intList)"E.replacethemethoddeclarationwith"sum(List<int>intList)"F.replacethemethoddeclarationwith"sum(List<Integer>intList)"Answer:(A,C,F(xiàn))publicstaticintsum(List<Integer>intList){intsum=0;for(inti:intList){ sum+=i;}returnsum;}參照大綱:集合和泛型Whatistheresult?A.Compilationfailsduetoanerrorinline23.B.Compilationfailsduetoanerrorinline29.C.AClassCastExceptationoccursinline29.D.AClassCastExceptationoccursinline31.E.Thevalueofallfourobjectprintsinnaturalorder.Answer:(C)Arrays.sort(Object[]a)辦法中,a每一種元素都必要是互相可以比較(調用pareTo(Objecto2))。否則會報ClassCastException異常。參照大綱:泛型QUESTION68PlacethecodeintopositiontocreateaclassthatmapsfromStringstoIntegervalues.Theresultofexecutionmustbe[one].Someoptionsmaybeusedmorethanonce.Answer:()publicclassNumberNames{ privateHashMap<String,Integer>map=newHashMap<String,Integer>(); publicvoidput(Stringname,Integervalue){ map.put(name,value); } publicSet<String>getNames(){ Returnmap.keySet(); }}QUESTION69Placearesultontoeachmethodcalltoindicatewhatwouldhappenifthemethodcallwereinsertedatline9.Note:Resultscanbeusedmorethanonce.Answer:()MethodResultm1(listA)Compilesandrunswithouterror泛型規(guī)范沒問題m2(listA)Compilesandrunswithouterror泛型規(guī)范沒問題m1(listB)CompilesandrunswithouterrorB是A子類,泛型規(guī)范沒問題m2(listB)Doesnotcompilem1(listO)Doesnotcompilem2(listO)DoesnotcompileQUESTION70Giventheexhibit:Whatistheresult?A.apple:appleB.carrot:appleC.apple:bananaD.banana:appleE.carrot:carrotF.carrot:bananaAnswer:(C)PriorityQueue優(yōu)先級隊列:預設是自然排序,因而pq內元素順序將是apple->banana->carrotpoll()取第一種元素,取完之后刪除,peek取第一種元素,并不刪除元素QUESTION71Given:AprogrammerisdevelopingaclassKey,thatwillbeusedasakeyinastandardjava.util.HashMap.Whichtwomethodsshouldbeoverriddentoassurethatkeyworkscorrectlyasakey?(choosetwo)A.publicinthashCode()B.publicBooleanequals(Keyk)C.publicintcompareTo(Objecto)D.publicBooleanequals(Objecto)Answer:(A,D)HashMap中key不能重復,因而必要實現(xiàn)hashCode和equals辦法QUESTION72---Giventheexhibit:Whichtwo,insertedatline2willallowthecodetocompile?(ChooseTwo)A.publicclassMinMax<?>{B.publicclassMinMax<?extendsNumber>{C.publicclassMinMax<NextendsObject>{D.publicclassMinMax<NextendsNumber>{E.publicclassMinMax<?extendsObject>{F.publicclassMinMax<NextendsInteger>{Answer:(D,F(xiàn))N是泛型類別變量,它相稱于一種類型。A 類聲明是不能用?這個萬用字符。B 同上C Object沒有doubleValue()辦法。D OK.E 同A。F OK.QUESTION73Giventheexhibit:enumExample{ONE,TWO,THREE}Whichstatementistrue?A.Theexpressions(ONE==ONE)andONE.equals(ONE)arebothguaranteedtobetrue.B.Theexpression(ONE<TWO)isguaranteedtobetrueandONE.compareTo(TWO)isguaranteedtobelessthanone.C.TheExamplevaluescannotbeusedinarawjava.util.HashMap.;instead,theprogrammermustuseajava.util.EnumMap.D.TheExamplevaluescanbeusedinajava.util.SortedSet,butthesetwillNOTbesortedbecauseenumeratedTypedoNOTIMPLEMENTjava.lang.Comparable.Answer:(A)A對的B不能保證C錯誤枚舉類型元素是可以用在HASHMAP里HashMap<Integer,Example>h=newHashMap<Integer,Example>;h.put(1,Example.ONE);D錯誤,枚舉類型元素值是可以放入SortedSet里例如TreeSet.把枚舉類型元素轉成字符串在放入其中,字符串就已經(jīng)實現(xiàn)comparable接口??梢宰匀慌判?。SortedSet<Example>s=newTreeSet<Example>();s.add(Example.TWO);s.add(Example.ONE);System.out.println(s);打印出成果[ONE,TWO]QUESTION74Giventheexhibit:WhichlineofcodemarkstheearliestpointthatanobjectreferencedbyintObjbecomesacandidateforgarbagecollection?A.Line16B.Line17C.Line18D.Line19E.TheobjectisNOTacandidateforgarbagecollection.Answer:(D)intObj始終會被numbers引用,直到19行之后QUESTION75Given:Andthecommandlineinvocation:javaYippee2abcWhatistheresult?A.abB.bcC.abcD.Compilationfails.E.Anexceptionisthrownatruntime.Answer:(B)QUESTION76Aclassgames.cards.PokeriscorrectlydefinedinthejarfilePoker.jar.AuserwantstoexecutethemainmethodofPokeronaUNIXsystemusingthecommand:Javagames.cards.PokerWhatallowstheusertodothis?A.putPoker.jarindirectory/stuff/java,andsettheCLASSPATHtoinclude/stuff/javaB.putPoker.jarindirectory/stuff/java,andsettheCLASSPATHtoinclude/stuff/java/*.jarC.putPoker.jarindirectory/stuff/java,andsettheCLASSPATHtoinclude/stuff/java/Poker.jarD.putPoker.jarindirectory/stuff/java/games/cards,andsettheCLASSPATHtoinclude/stuff/javaE.putPoker.jarindirectory/stuff/java/games/cards,andsettheCLASSPATHtoinclude/stuff/java/*.jarF.putPoker.jarindirectory/stuff/java/games/cards,andsettheCLASSPATHtoinclude/stuff/java/Poker.jarAnswer:(C)classpath中須明確寫明poker.jar,不能用*.jarQUESTION77Whichthreecodefragments,addedindividuallyatline29,producetheoutput100?(Choosethree.)A.n=100;B.i.setX(100);C.o.getY().setX(100);D.i=newInner();i.setX(100);E.0.setY(i);i=newInner();i.setX(100);F.i=newInner();i.setX(100);o.setY(i);Answer:(B,C,F(xiàn))依照內存關系可知QUESTION78GivenaclassRepetition:AndgivenanotherclassDemo:Whichcodeshouldbeinsertedatline1ofDemo.javatocompileandrunDemotoprint"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)靜態(tài)import引入靜態(tài)辦法.importstaticutils..Repetition*;或者importstaticutils.Repetition.twice;A 正常導入類,Demo第5行要new實例才干帶用twice辦法.B staticimport順序顛倒,并且要加上class名C 正常導入,類名背面不能跟*D 順序顛倒E 正常導入,只能導入包下類,不能導入類里辦法.G 順序顛倒QUESTION79Given:Andtheinvocation:Whatistheresult?A.Anexceptionisthrownatruntime.B."Stringisempty"isprintedtooutput.C.Compilationfailsbecauseofanerrorinline12.D."Stringisnotempty"isprintedtooutput.Answer:(A)A空指針異常------------------“|”是非短路邏輯運算符QUESTION80Exhibit:Giventhefully-qualifiedclassnames:com.foo.bar.Dogcom.foo.bar.blatz.Bookcom.bar.Carcom.bar.blatz.SunWhichgraphrepresentsthecorrectdirectorystructureforaJARfilefromwhichthoseclassescanbeusedbythecompilerandJVM?A.JarAB.JarBC.JarCD.JarDE.JarEAnswer:(A)QUESTION81Given:andtwoseparatecommandlineinvocations:javaYippeejavaYippee1234Whatistheresult?Nooutputisproduced.123B. Nooutputisproduced.234C. Nooutputisproduced.1234D. Anexceptionisthrownatruntime.123E. Anexceptionisthrownatruntime.234F. Anexceptionisthrownatruntime.1234Answer:(B)QUESTION82Given:Whatistheresult?A.CompilationfailsB.AnexceptionisthrownatruntimeC.doStuffx=6mainx=6D.doStuffx=5mainx=5E.doStuffx=5mainx=6F.doStuffx=6mainx=5Answer:(D)第10行參數(shù)x是值傳遞,不會變化main中x值。QUESTION83Given:WhenthedoSomethingmethodiscalled,afterwhichlinedoestheObjectcreatedinline5becomeavailableforgarbagecollection?A.Line5B.Line6C.Line7D.Line8E.Line9F.Line10Answer:(D)棧內存用來存儲基本類型變量和對象引用變量(對象地址)堆內存用來存儲由new創(chuàng)立對象和數(shù)組QUESTION84Given:Whatistheresult?A. ExceptionB. A,B,ExceptionC. Compilationfailsbecauseofanerrorinline20.D. Compilationfailsbecauseofanerrorinline14.E. ANullPointerExceptionisthrownatruntime.Answer:(D)改寫規(guī)定,子類拋出異常要比父類異常要小.本題中父類沒有異常,子類也不能有異常.QUESTION85Given:Whatistheresult?A.harrierB.shepherdC.retrieverD.CompilationfailsE.retrieverharrierF.Anexceptionisthrownatruntime.Answer:(D)18行,casedefault:語法錯誤,應改成default:QUESTION86Given:Whatistheresult?A. A,B,CB. B,C,AC. CompilationfailsD. ThecoderunswithnooutputE. AnexceptionisthrownatruntimeAnswer:(B)LinkedList有順序性,QUESTION87GivenWhatistheresult?A.endB.CompilationfailsC.exceptionendD.exceptiontestendE.AThrowableisthrownbymainF.AnExceptionisthrownbymainAnswer:(E)16行拋出Error,沒有捕獲。Throwable,Error和Exception都是她子類QUESTION88Given:Whichthree,willmakecodeon37executeA.Theinstancegetsgarbagecollected.B.Thecodeonline33throwsanexception.C.Thecodeonline35throwsanexception.D.Thecodeonline31throwsanexception.E.Thecodeonline33executessuccessfully.Answer:(B,C,E)QUESTION89Given:Whatistheresult?A.CompilationfailsB.piisbiggerthan3.C.Anexceptionoccursatruntime.D.piisbiggerthan3.Haveaniceday.E.piisnotbiggerthan3.Haveaniceday.Answer:(A)18行finally是配合try使用.QUESTION90Given:Whichcode,insertedatline16willcauseajava.lang.ClassCastException?A.Alphaa=x;B.Foof=(Delta)x;C.Foof=(Alpha)x;D.Betab=(Beta)(Alpha)x;Answer:(B)轉到子類別拋異常。.QUESTION91Givenamethodthatmustensurethatitsparameterisnotnull:What,insertedatline12,istheappropriatewaytohandleanullvalue?A.assertvalue==null;B.assertvalue!=null,"valueisnull";C.if(value==null){thrownewAssertionException("valueisnull");}D.if(value==null){thrownewIllegalArgumentException("valueisnull");}Answer:(D)A 不要用斷言對公共辦法參數(shù)進行判斷B 同上C 沒有AssertionException這個類;AssertionError繼承自Error,handleerror是沒故意義D OK拋出參數(shù)錯誤異常.QUESTION92PlacethecorrectCodeintheCodeSampletoachievetheexpectedresults.Expectedresults:Output:12481632CodeSampleAnswer:()for(intx:y){QUESTION93Given:WhichtwowillproduceanAssertionError?(Choosetwo.)A.javatestB.java-eatestC.javatestfile1D.java-eatestfile1E.java-eatestfile1file2F.java–ea:testtestfile1Answer:(B,E)QUESTION94Given:WhichstatementistrueifaResourceExceptionisthrownonline86?A.Line92willnotexecute.B.Theconnectionwillnotberetrievedinline85.C.Theresourceconnectionwillnotbeclosedonline88. D.Theenclosingmethodwillthrowanexceptiontoitscaller.Answer:(C)QUESTION95AssumingthattheserializeBanana()andthedeserializeBanana()methodswillcorrectlyuseJavaserializationandgiven:Whatistheresult?A.restore400B.restore403C.restore453D.Compilationfails.E.Anexceptionisthrownatruntime.Answer:(C)QUESTION96Given:Whatistheresult?A.CompilationfailsB.Piisapproximately3.C.Piisapproximately3.141593.D.Anexceptionisthrownatruntime.Answer:(D)%d打印一種整數(shù),規(guī)定接受一種整數(shù)拋IllegalFormatConversionExceptionQUESTION97Given:Whatistheresult?A.intLongB.ShortLongC.CompilationfailsD.Anexceptionisthrownatruntime.Answer:(A)QUESTION98Chaintheseconstructorstocreateobjectstoreadfromafilenamed"in"andtowritetoafilenamed"out".Answer:()newBufferedReader(newFileReader(“in”));newPrintWriter(newBufferedWriter(newFileWriter(“out”)));QUESTION99PlacethecodefragmentsintopositiontouseaBufferedReadertoreadinanentiretextfile.Answer:()classPrintFile{ publicstaticvoidmain(String[]args){ BufferedReaderbuffReader=null; //morecodeheretoinitializebuffReader try{ Stringtemp; while((temp=buffReader.readLine())!=null){ System.out.println(temp); } }catch(IOExceptione){ e.printStackTrace(); } }}QUESTION100Giventhismethodinaclass:Whichstatementistrue?A.ThiscodeisNOTthread-safe.B.TheprogrammercanreplaceStringBufferwithStringBuilderwithnootherchanges.C.Thiscodewillperformpoorly.Forbetterperformance,thecodeshouldberewritten:return"<"++">";D.ThiscodewillperformwellandconvertingthecodetouseStringBuilderwillnotenhancetheperformance.Answer:(B)QUESTION101Given:WhatcreatestheappropriateDateFormatobjectandaddsadaytotheDateobject?A. 35.Dateformatdf=Dateformat.getDateFormat();42.d.setTime((60*60*24)+d.getTime());B. 35.Dateformatdf=Dateformat.getDateInstance();42.d.setTime((1000*60*60*24)+d.getTime());C. 35.Dateformatdf=Dateformat.getDateFormat();42.d.setLocalTime((1000*60*60*24)+d.getLocalTime());D. 35.Dateformatdf=Dateformat.getDateInstance();42.d.setLocalTime((60*60*24)+d.getLocalTime());Answer:(B)轉換成求加1天后來改日期毫秒數(shù),再調用setTime()設立時間QUESTION102Given:WhichtwostatementsaretrueabouttheresultifthelocaleisLocale.US?(Choosetwo.)A.Thevalueofbis2.B.Thevalueofais3.14.C.Thevalueofbis2.00.D.Thevalueofais3.141.E.Thevalueofais3.1415.F.Thevalueofais3.1416.G.Thevalueofbis2.0000.Answer:(C,F(xiàn))QUESTION103Placethecorrectdescriptionofthecompileroutputonthecodefragmenttobeinsertedatline4and5.Thesamecompileroutputmaybeusedmorethanonce.Answer:()QUESTION104Given:Whichthreewillcompilesuccessfully?(Choosethree.)A.Objecto=Old.get0(newLinkedList());B.Objecto=Old.get0(newLinkedList<?>());C.Strings=Old.get0(newLinkedList<String>());D.Objecto=Old.get0(newLinkedList<Object>());E.Strings=(String)Old.get0(newLinkedList<String>());Answer:(A,D,E)B錯誤<?>不應出當前這里C錯誤get0()辦法回傳值是Object,因而不可賦值給StringQUESTION105Exhibit:Whichstatementistrueaboutthesetvariableonline12?A.Thesetvariablecontainsallsixelementsfromthecollcollection,andtheorderisguaranteedtobepreserved.B.Thesetvariablecontainsonlythreeelementsfromthecollcollection,andtheorderisguaranteedtobepreserved.C.Thesetvariablecontainsallsixelementsfromthecollcollection,buttheorderisNOTguaranteedtobepreserved.D.Thesetvariablecontainsonlythreeelementsfromthecollcollection,buttheorderisNOTguaranteedtobepreserved.Answer:(D)Set中元素是不能重復,沒有順序QUESTION106Given:WhatistheappropriateddefinitionofthehashCodemethodinclassPerson?A.returnsuper.hashCode();B.returnname.hashCode()+age*7;C.returnname.hashCode()+comment.hashCode()/2;D.returnname.hashCode()+comment.hashCode()/2-age*3;Answer:(B)兩個equals對象,hashCode()應當相等,equals中是判斷age和name相等,因此hashCode也用age和name計算,A,C,D也許導致兩個相等對象,hashCode不相等QUESTION107Given:Whichstatementistrue?A.TheequalsmethoddoesNOTproperlyoverridetheObject.equalsmethod.B.Compilationfailsbecausetheprivateattributecannotbeaccessedinline5.C.Toworkcorrectlywithhash-baseddatastructures,thisclassmustalsoimplementthehashCodemethod.D.WhenaddingPersonobjectstojava.util.Setcollection,theequalsmethodinline4willpreventduplicates.Answer:(A)QUESTION108Given:Whichcode,insertedatline4,guaranteesthatthisprogramwilloutput[1,2]?A.Setset=newTreeSet();B.Setset=newHashSet();C.Setset=newSortedSet();D.Listset=newSortedList();E.Setset=newLinkedHashSet();Answer:(A)TreeSet可自動排序,SortedSet是接口,不能實例化QUESTION109Given:What,insertedatline39,willsortthekeysinthepropsHashMap?A.Array.sort(s);B.s=newTreeSet(s);C.Collections.sort(s);D.s=newSortedSet(s);Answer:(B)QUESTION110Placecodeintotheclasssothatitcompilesandgeneratestheoutputanswer=42.Note:Codeoptionsmaybeusedmorethanonce.Answer:()publicclassGen<T>{ privateTobject; publicGen(Tobject){ this.object=object;}publicTgetObject(){ returnobject;}…}QUESTION111----------------???第一選項解釋Given:PlacetheCompilationResultsoneachcodestatementtoindicatewhetherornotthatcodewillcompileifinsertedintothetakeList()method.Answer:()List<String>StrList=newArrayList<String>();List<Integer>IntList=newArrayList<Integer>();List<?extendsObject>list;//該類型泛型之能接受對象賦值,不能直接對該對象進行add操作.//list.add(newObject());list=StrList;list=IntList;QUESTION112WhichtwocodefragmentswillexecutethemethoddoStuff()inaseparatethread?(Choosetwo.)A. newThread(){publicvoidrun(){doStuff();}};B. newThread(){publicvoidstart(){doStuff();}};C. newThread(){publicvoidstart(){doStuff();}}.run();D. newThread(){publicvoidrun(){doStuff();}}.start();E. newThread(newrunnable(){publicvoidrun(){doStuff();}}).run();F. newThread(newrunnable(){publicvoidrun(){doStuff();}}).start();Answer:(D,F(xiàn))D匿名類別中復寫run辦法,并調用start()辦法啟動線程F運用匿名實現(xiàn)runnable接口中run辦法,并調用start()啟動線程QUESTION113Given:Whichtocanberesults?(Choosetwo.)A. java.lang.RuntimeException:ProblemB. run.java.lang.RuntimeException:ProblemC. Endofmethod.java.lang.RuntimeException:ProblemD. Endofmethod.run.java.lang.RuntimeException:ProblemE. run.java.lang.RuntimeException:ProblemEndofmethodAnswer:(D、E)在t中拋出RuntimeException,不干擾主線程執(zhí)行;QUESTION114----Given:Whichthreechangesshouldbemadetoadaptthisclasstobeusedsafelybymultiplethreads?(Choosethree.)A.declarereset()usingthesynchronizedkeywordB.declaregetName()usingthesynchronizedkeywordC.declaregetCount()usingthesynchronizedkeywordD.declaretheconstructorusingthesynchronizedkeywordE.declareincrement()usingthesynchronizedkeywordAnswer:(A,C,E)D選項錯誤,由于構造辦法不能用synchronized修飾name是final變量不會有多線程上維護問題QUESTION115Given:Whichstatementistrue?A.CompilationfailsB.Anexceptionisthrownatruntime.C.Synchronizingtherun()methodwouldmaketheclassthread-safe.D.Thedatainvariable"x"areprotectedfromconcurrentaccessproblems.E.DeclaringthedoThings()methodasstaticwouldmaketheclassthread-safe.F.WrappingthestatementswithindoThings()inasy
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度教育信息化產品采購合同技術規(guī)范詳解2篇
- Starter Section 8 Our Neighbourhood(說課稿)-2024-2025學年北師大版(2024)初中英語七年級上冊
- 專用檢測代理協(xié)議2024年版版B版
- 2025年度鞋類產品品牌保護與侵權糾紛處理合同3篇
- 《故都的秋》《荷塘月色》《我與地壇》聯(lián)讀說課稿 2024-2025學年統(tǒng)編版高中語文必修上冊
- Module 4 Unit 1 Thanksgiving is very important in the US(說課稿)-2024-2025學年外研版(一起)英語六年級上冊
- Unit1 Lesson 1 Shes very kind.(說課稿)-2024-2025學年魯科版(五四學制) (三起)英語五年級上冊
- 微項目1《探索數(shù)據(jù)表格構建》說課稿-2024-2025學年泰山版(2019)初中信息技術第三冊
- 企業(yè)安全生產基礎知識培訓考核試卷
- 保險法律咨詢考核試卷
- 《國有控股上市公司高管薪酬的管控研究》
- 餐飲業(yè)環(huán)境保護管理方案
- 人教版【初中數(shù)學】知識點總結-全面+九年級上冊數(shù)學全冊教案
- 食品安全分享
- 礦山機械設備安全管理制度
- 計算機等級考試二級WPS Office高級應用與設計試題及答案指導(2025年)
- 造價框架協(xié)議合同范例
- 糖尿病肢端壞疽
- 《創(chuàng)傷失血性休克中國急診專家共識(2023)》解讀課件
- 小學六年級數(shù)學100道題解分數(shù)方程
- YY 0838-2021 微波熱凝設備
評論
0/150
提交評論