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.changethemethodsignatureonli

题目
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.


相似考题
参考答案和解析
参考答案:D
更多“publicvoidaddStrings(Listlist){12.list.add(”foo”);13.list.add(”bar”);14.}Whatmustyouchangeinthismethodtocompilewithoutwarnings?() ”相关问题
  • 第1题:

    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.


    参考答案:F

  • 第2题:

    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 A

    B.Jar B

    C.Jar C

    D.Jar D

    E.Jar E


    参考答案:A

  • 第3题:

    Given:fooandbararepublicreferencesavailabletomanyotherthreads.fooreferstoaThreadandbarisanObject.Thethreadfooiscurrentlyexecutingbar.wait().Fromanotherthread,whatprovidesthemostreliablewaytoensurethatfoowillstopexecutingwait()?

    A.foo.notify();

    B.bar.notify();

    C.foo.notifyAll();

    D.Thread.notify();

    E.bar.notifyAll();


    参考答案:E

  • 第4题:

    intindex=1;int[]foo=newint[3];intbar=foo[index];intbaz=bar+index;Whatistheresult?()

    A.Bazhasthevalueof0

    B.Bazhasthevalueof1

    C.Bazhasthevalueof2

    D.Anexceptionisthrown.

    E.Thecodewillnotcompile.


    参考答案:B

  • 第5题:

    Given:Whichtwocodefragments,insertedindependentlyatline5,willcompilewithoutwarnings?()

    A.publicvoidaddStrings(Listlist){

    B.publicvoidaddStrings(List<String>list){

    C.publicvoidaddStrings(List<?superString>list){

    D.publicvoidaddStrings(List<?extendsString>list){B,C


    参考答案:B, C