单选题现自:  class Car implements Serializable  ()      class Ford extends Car  {}  如果试图序列化一个Ford实例,结果为()A 编译失败B 两个对象被序列化C —个对象被序列化D 运行时异常被抛出

题目
单选题
现自:  class Car implements Serializable  ()      class Ford extends Car  {}  如果试图序列化一个Ford实例,结果为()
A

编译失败

B

两个对象被序列化

C

—个对象被序列化

D

运行时异常被抛出


相似考题
更多“单选题现自:  class Car implements Serializable  ()      class Ford extends Car  {}  如果试图序列化一个Ford实例,结果为()A 编译失败B 两个对象被序列化C —个对象被序列化D 运行时异常被抛出”相关问题
  • 第1题:

    现自:  class Car implements Serializable  ()      class Ford extends Car  {}  如果试图序列化一个Ford实例,结果为()  

    • A、编译失败
    • B、两个对象被序列化
    • C、—个对象被序列化
    • D、运行时异常被抛出

    正确答案:C

  • 第2题:

    class Guy{String greet(){return “hi“}}   class Cowboy extends Guy {String greet(){return“howdy”}}   class Surfer extends Guy {String greet(){return“dudel”}}  class Greetings{   public static void main (string[]args){   Guy[] guy= {new Guy(),new Cowboy(),new Surfer()};   for(Guy 0: guys)   System.out.print(g.green());  }   }   结果为:  

    • A、运行时异常被输出
    • B、第7行出现一个错误,编译失败
    • C、第8行出现一个错误,编译失败
    • D、hi hi hi
    • E、hi hawdy doude

    正确答案:E

  • 第3题:

    现自:  1.  interface Color {  }      2. interface Weight  {  }      3.  //insert code here    和以下足六个声明:  class Boat extends Color, extends Weight  {  }     class Boat extends Color and Weight  {  }      class Boat extends Color, Weight  {  }  class Boat implements Color,  implements Weight  {  }     class Boat implements Color and Weight  {  }      class Boat implements Color, Weight  {  }    分别插入到第3行,有多少行可以编译? () 

    • A、  0
    • B、  1
    • C、  2
    • D、  3

    正确答案:B

  • 第4题:

    class Car implements Serializable { }   class Ford extends Car { }   如果试图序列化一个Ford实例,结果为()  

    • A、编译失败
    • B、一个对象被序列化
    • C、两个对象被序列化
    • D、运行时异常被抛出

    正确答案:C

  • 第5题:

    现有:  class ThreadBoth extends Threaa implements Runnable  {      public void run()  (System.out.print("hi");  }     public static voicl main (String  []  args)  {     Thread tl=new ThreadBoth():      Thread t2 = new Thread (tl):     tl.run():      t2.run():     }          结果为:()      

    • A、 hi hi
    • B、 hi
    • C、编译失败
    • D、运行时异常被抛出

    正确答案:A

  • 第6题:

    你正在定义个一叫做Certkiller的类,这个类包含如下内容. Certkiller类包含一个可以再对象上执行的叫做ProcessChildren的方法。 Cerkiller类的对象可以被序列化()

    • A、Apply the OnDeserializing attribute to the ProcessChildren method.
    • B、Specify that Certkiller Class implements the IDeserializationCallback interface.
    • C、Specify that Certkiller Class inherits from the ObjectManager class.
    • D、Apply the OnSerialized attribute to the ProcessChildren method.
    • E、Create a GetObjectData method that calls ProcessChildren.
    • F、Create an OnDeserialization method that calls ProcessChildren.

    正确答案:B,F

  • 第7题:

    单选题
    您最近创建了一个名为车辆的可序列化的类。 类如下所示: [Serializable] public class Vehicle { public string VIN; public string Make; private string Model; private int Year; private string Owner; } Certkiller.com 不想要序列化一个车辆对象,出于安全原因时永久保存的所有者字段。 您需要确保实现这一目标。 你应该做什么?()
    A

    适用于所有者字段的 OptionalField 属性。

    B

    应用,所以所有者字段的属性。

    C

    已实现 IFormatter 接口的自定义序列化的车辆类别。

    D

    做什么,因为在使用二进制序列化时,私营领域是永远不会保留。


    正确答案: B
    解析: 暂无解析

  • 第8题:

    单选题
    class Guy{String greet(){return “hi“}}   class Cowboy extends Guy {String greet(){return“howdy”}}   class Surfer extends Guy {String greet(){return“dudel”}}  class Greetings{   public static void main (string[]args){   Guy[] guy= {new Guy(),new Cowboy(),new Surfer()};   for(Guy 0: guys)   System.out.print(g.green());  }   }   结果为:
    A

    运行时异常被输出

    B

    第7行出现一个错误,编译失败

    C

    第8行出现一个错误,编译失败

    D

    hi hi hi

    E

    hi hawdy doude


    正确答案: C
    解析: 暂无解析

  • 第9题:

    单选题
    现有:  class ThreadBoth extends Threaa implements Runnable  {      public void run()  (System.out.print("hi");  }     public static voicl main (String  []  args)  {     Thread tl=new ThreadBoth():      Thread t2 = new Thread (tl):     tl.run():      t2.run():     }          结果为:()
    A

     hi hi

    B

     hi

    C

    编译失败

    D

    运行时异常被抛出


    正确答案: A
    解析: 暂无解析

  • 第10题:

    单选题
    class Car implements Serializable { }   class Ford extends Car { }   如果试图序列化一个Ford实例,结果为()
    A

    编译失败

    B

    一个对象被序列化

    C

    两个对象被序列化

    D

    运行时异常被抛出


    正确答案: D
    解析: 暂无解析

  • 第11题:

    单选题
    如果你被要求写一段代码读取一个序列化的对象,那么一般使用哪种Stream()
    A

    FileInputStream

    B

    FileReader

    C

    DataInputStream

    D

    ObjectInputStream


    正确答案: C
    解析: 暂无解析

  • 第12题:

    单选题
    现自:  class Car implements Serializable  ()      class Ford extends Car  {}  如果试图序列化一个Ford实例,结果为()
    A

    编译失败

    B

    两个对象被序列化

    C

    —个对象被序列化

    D

    运行时异常被抛出


    正确答案: D
    解析: 暂无解析

  • 第13题:

    现有:   class Parser extends Utils {   public static void main(String [] args) {     System.out.print(new Parser().getInt("42"));    }   int getInt(String arg) {  return Integer.parseInt(arg);  }    }   class Utils {     int getInt(String arg) throws Exception { return 42; }    }    结果为()  

    • A、 42
    • B、 编译失败。
    • C、 无输出结果。
    • D、 运行时异常被抛出。

    正确答案:A

  • 第14题:

    关于对象的序列化说法错误的是()。

    • A、 实现序列化的对象必须实现Serializable接口
    • B、 实现序列化的对象必须自定义序列号
    • C、 ObjectOutputStream中的writeObject()方法可以将对象写出
    • D、 ObjectInputStream中的readObject()方法可以读取对象

    正确答案:B

  • 第15题:

    现有:  class Guy {String greet()    {return "hi";  }  }  class Cowboy extends Guy  (  String greet()    (  return "howdy  ¨;    )  )  class Surfer extends Guy  (String greet()    (return "dude! ";)) class Greetings  {  public static void main (String  []  args)    {  Guy  []  guys =  ( new Guy(), new Cowboy(), new Surfer()  );  for (Guy g:  guys) System.out.print (g.greet()};  }  }  结果为:() 

    • A、 hi howdy dude!
    • B、运行时异常被抛出。
    • C、第7行出现一个错误,编译失败。
    • D、第8行出现一个错误,编译失败。

    正确答案:A

  • 第16题:

    现有:  class Pet implements Serializable  {      Collar c= new Collar();      }  class Collar implements Serializable  {      collarPart cpl=new CollarPart ("handle");      CollarPart cp2=new CollarPart ("clip");      }     class CollarPart implements Serializable()  如果Pet实例被序列化,则多少对象将被序列化?()    

    • A、0
    • B、1
    • C、2
    • D、3
    • E、4
    • F、5

    正确答案:E

  • 第17题:

    class Parser extends Utils {  public static void main(String [] args) {   System.out.print(new Parser().getInt("42"));  }  int getInt(String arg) {  return Integer.parseInt(arg);  }  }  class Utils {  int getInt(String arg) throws Exception { return 42; }  }  结果为:() 

    • A、42
    • B、编译失败
    • C、无输出结果
    • D、运行时异常被抛出

    正确答案:A

  • 第18题:

    如果你被要求写一段代码读取一个序列化的对象,那么一般使用哪种Stream()

    • A、FileInputStream
    • B、FileReader
    • C、DataInputStream
    • D、ObjectInputStream

    正确答案:D

  • 第19题:

    单选题
    现有:   class Parser extends Utils {   public static void main(String [] args) {     System.out.print(new Parser().getInt("42"));    }   int getInt(String arg) {  return Integer.parseInt(arg);  }    }   class Utils {     int getInt(String arg) throws Exception { return 42; }    }    结果为()
    A

     42

    B

     编译失败。

    C

     无输出结果。

    D

     运行时异常被抛出。


    正确答案: D
    解析: 暂无解析

  • 第20题:

    单选题
    关于对象的序列化说法错误的是()。
    A

     实现序列化的对象必须实现Serializable接口

    B

     实现序列化的对象必须自定义序列号

    C

     ObjectOutputStream中的writeObject()方法可以将对象写出

    D

     ObjectInputStream中的readObject()方法可以读取对象


    正确答案: D
    解析: 暂无解析

  • 第21题:

    多选题
    你正在定义个一叫做Certkiller的类,这个类包含如下内容. Certkiller类包含一个可以再对象上执行的叫做ProcessChildren的方法。 Cerkiller类的对象可以被序列化()
    A

    Apply the OnDeserializing attribute to the ProcessChildren method.

    B

    Specify that Certkiller Class implements the IDeserializationCallback interface.

    C

    Specify that Certkiller Class inherits from the ObjectManager class.

    D

    Apply the OnSerialized attribute to the ProcessChildren method.

    E

    Create a GetObjectData method that calls ProcessChildren.

    F

    Create an OnDeserialization method that calls ProcessChildren.


    正确答案: F,E
    解析: IDeserializationCallback接口允许一些已完成的对象图后调用的自定义代码.通过onDeserialization方法反序列化。在这种情况下,应在onDeserialization方法中调用ProcessChildren。

  • 第22题:

    单选题
    现自:  1.  interface Color {  }      2. interface Weight  {  }      3.  //insert code here    和以下足六个声明:  class Boat extends Color, extends Weight  {  }     class Boat extends Color and Weight  {  }      class Boat extends Color, Weight  {  }  class Boat implements Color,  implements Weight  {  }     class Boat implements Color and Weight  {  }      class Boat implements Color, Weight  {  }    分别插入到第3行,有多少行可以编译? ()
    A

      0

    B

      1

    C

      2

    D

      3


    正确答案: A
    解析: 暂无解析

  • 第23题:

    单选题
    现有:  class Guy {String greet()    {return "hi";  }  }  class Cowboy extends Guy  (  String greet()    (  return "howdy  ¨;    )  )  class Surfer extends Guy  (String greet()    (return "dude! ";)) class Greetings  {  public static void main (String  []  args)    {  Guy  []  guys =  ( new Guy(), new Cowboy(), new Surfer()  );  for (Guy g:  guys) System.out.print (g.greet()};  }  }  结果为:()
    A

     hi howdy dude!

    B

    运行时异常被抛出。

    C

    第7行出现一个错误,编译失败。

    D

    第8行出现一个错误,编译失败。


    正确答案: A
    解析: 暂无解析

  • 第24题:

    单选题
    现有:  class Pet implements Serializable  {      Collar c= new Collar();      }  class Collar implements Serializable  {      collarPart cpl=new CollarPart ("handle");      CollarPart cp2=new CollarPart ("clip");      }     class CollarPart implements Serializable()  如果Pet实例被序列化,则多少对象将被序列化?()
    A

    0

    B

    1

    C

    2

    D

    3

    E

    4

    F

    5


    正确答案: C
    解析: 暂无解析