publicvoidaddStrings(Listlist){12.list.add(”foo”);13.list.add(”bar”);14.}Whatmustyouchangeinthismethodtocompilewithoutwarnings?() A.addthiscodeafterline11:list=(List)list;B.changelines12and13to:list.add(”foo”);list.add(”bar”);C.changethemethodsignatureonline11to:publicvoidaddStrings(ListextendsStringlist){D.changethemethodsignatureonline11to:publicvoidaddStrings(ListsuperStringlist){E.Nochangesarenecessary.Thismethodcompileswithoutwarnings.

publicvoidaddStrings(Listlist){12.list.add(”foo”);13.list.add(”bar”);14.}Whatmustyouchangeinthismethodtocompilewithoutwarnings?()

A.addthiscodeafterline11:list=(List)list;

B.changelines12and13to:list.add(”foo”);list.add(”bar”);

C.changethemethodsignatureonline11to:publicvoidaddStrings(List<extendsString>list){

D.changethemethodsignatureonline11to:publicvoidaddStrings(List<superString>list){

E.Nochangesarenecessary.Thismethodcompileswithoutwarnings.


相关考题:

Given:fooandbararepublicreferencesavailabletomanyotherthreads,fooreferstoaThreadandbarisanObject.Thethreadfooiscurrentlyexecutingbar.wait().Fromanotherthread,whatprovidesthemostreliablewaytoensurethatfoowillstopexecutingwait()?()A.foo.notify();B.bar.notify();C.foo.notifyAll();D.Thread.notify();E.bar.notifyAll();F.Object.notify();

Giventhefully-qualifiedclassnames:com.foo.bar.Dogcom.foo.bar.blatz.Bookcom.bar.Carcom.bar.blatz.SunWhichgraphrepresentsthecorrectdirectorystructureforaJARfilefromwhichthoseclassescanbeusedbythecompilerandJYM?()A.JarAB.JarBC.JarCD.JarDE.JarE

publicclassBase{publicstaticfinalStringFOO=foo”;publicstaticvoidmain(String[]args){Baseb=newBase();Subs=newSub();System.out.print(Base.FOO);System.out.print(Sub.FOO);System.out.print(b.FOO);System.out.print(s.FOO);System.out.print(((Base)s).FOO);}}classSubextendsBase{publicstaticfinalStringFOO=bar;}Whatistheresult?()A.foofoofoofoofooB.foobarfoobarbarC.foobarfoofoofooD.foobarfoobarfooE.barbarbarbarbarF.foofoofoobarbarG.foofoofoobarfoo

fooandbararepublicreferencesavailabletomanyotherthreads.fooreferstoaThreadandbarisanObject.Thethreadfooiscurrentlyexecutingbar.wait().Fromanotherthread,whichstatementisthemostreliablewaytoensuethatfoowillstopexecutingwait()?A.foo.notify();B.bar.notify();C.foo.notifyAll();D.Thread.notify();E.bar.notiFYAll();F.Object.notify();

Stringfoo=blue”;Boolean[]bar=newBoolean[1];if(bar[0]){foo=green”;}Whatistheresult?() A.Foohasthevalueof“”B.Foohasthevalueofnull.C.Foohasthevalueof“blue”D.Foohasthevalueof“green”E.Anexceptionisthrown.F.Thecodewillnotcompile.

intindex=1;int[]foo=newint[3];intbar=foo[index];intbaz=bar+index;Whatistheresult?() A.Bazhasthevalueof0B.Bazhasthevalueof1C.Bazhasthevalueof2D.Anexceptionisthrown.E.Thecodewillnotcompile.

Click the Exhibit button. Given the fully-qualified class names: com.foo.bar.Dog com.foo.bar.blatz.Book com.bar.Car com.bar.blatz.Sun Which graph represents the correct directory structure for a JAR file from which those classes can be used by the compiler and JVM? ()A.Jar AB.Jar BC.Jar CD.Jar DE.Jar E

Given:Whichtwocodefragments,insertedindependentlyatline5,willcompilewithoutwarnings?() A.publicvoidaddStrings(Listlist){B.publicvoidaddStrings(ListStringlist){C.publicvoidaddStrings(List?superStringlist){D.publicvoidaddStrings(List?extendsStringlist){B,C

Given:fooandbararepublicreferencesavailabletomanyotherthreads.fooreferstoaThreadandbarisanObject.Thethreadfooiscurrentlyexecutingbar.wait().Fromanotherthread,whatprovidesthemostreliablewaytoensurethatfoowillstopexecutingwait()?A.foo.notify();B.bar.notify();C.foo.notifyAll();D.Thread.notify();E.bar.notifyAll();