nerdexam
Oracle

1Z0-819 · Question #99

Given: public class Confidential implements Serializable{ private String data; public Confidential(String data) { this.data = data; } } Which two are secure serialization of these objects? (Choose…

The correct answer is A. Define fields transient that shouldn't be serialized. C. Implement only writeReplace to replace the instance with a serial proxy and not readResolve. See the full explanation below for the reasoning.

Question

Given: public class Confidential implements Serializable{ private String data; public Confidential(String data) { this.data = data; } } Which two are secure serialization of these objects? (Choose two.)

Options

  • ADefine fields transient that shouldn't be serialized.
  • BDeclare fields transient
  • CImplement only writeReplace to replace the instance with a serial proxy and not readResolve.
  • DImplement only readResolve to replace the instance with a serial proxy and not writeReplace.
  • EImplement only writeReplace to replace the instance with a serial proxy and not readResolve.

How the community answered

(42 responses)
  • A
    79% (33)
  • B
    14% (6)
  • D
    2% (1)
  • E
    5% (2)

Community Discussion

No community discussion yet for this question.

Full 1Z0-819 Practice