更多“AssumingthattheserializeBanana()andthedeserializeBanana()methodswillcorrectlyuseJavaserializationandgiven:Whatistheresult?() ”相关问题
  • 第1题:

    AssumingthattheserializeBanana2()andthedeserializeBanana2()methodswillcorrectlyuseJavaserializationandgiven:

    importjava.io.*;

    classFood{Food(){System.out.print(”1”);}}

    classFruitextendsFoodimplementsSerializable{

    Fruit(){System.out.print(”2”);}}

    publicclassBanana2extendsFruit{intsize=42;

    publicstaticvoidmain(String[]args){

    Banana2b=newBanana2();

    b.serializeBanana2(b);//assumecorrectserialization

    b=b.deserializeBanana2(b);//assumecorrect

    System.out.println(”restored+b.size+);}

    //moreBanana2methods

    }

    Whatistheresult?()


    参考答案:D

  • 第2题:

    Given:What is the result?()

    A.Compilation fails.

    B.exception is thrown at runtime.

    C.The attribute id in the ItemTest object remains unchanged.

    D.The attribute id in the ItemTest object is modified to the new value.

    E.A new ItemTest object is created with the preferred value in the id attribute.


    参考答案:A

  • 第3题:

    Given:AprogrammeriteratesovertheTreeSetandprintsthenameofeachDrinkobject.Whatistheresult?()

    A.Tea

    B.Coffee

    C.CoffeeTea

    D.Compilationfails


    参考答案:B

  • 第4题:

    intindex=1;Stringtest=newString;Stringfoo=test[index];Whatistheresult?()

    A. Foohasthevalue“”

    B.Foohasthevaluenull

    C.Anexceptionisthrown

    D.Thecodewillnotcompile


    参考答案:B

  • 第5题:

    Given:IfaninstanceofclassBeagleiscreated,thenSerialized,thendeSerialized,whatistheresult?()

    A.ad

    B.ada

    C.add

    D.adad


    参考答案:B