Java OCA OCP Practice Question 490

Question

Suppose class A extends Object; class B extends A; and class C extends B.

Of these, only class C implements java.io.Serializable.

Which of the following must be true in order to avoid an exception during deserialization of an instance of C?

  • A. A must have a no-args constructor.
  • B. B must have a no-args constructor.
  • C. C must have a no-args constructor.
  • D. There are no restrictions regarding no-args constructors.


B.

Note

The lowest-level non-serializable superclass of the object being deserialized must have a no-args constructor.




PreviousNext

Related