exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 185 discussion

Actual exam question from Oracle's 1z0-819
Question #: 185
Topic #: 1
[All 1z0-819 Questions]

Given the code fragment from Box.java:



Given the code fragment from Item.java:



Given the information:

The classes Box and Item are encapsulated with getters and setters methods.
The classes Box and Item contains required constructors source code.

and the code fragment:



Which action serializes the b1 object?

  • A. Handle NotSerializableException in the try clause or throw in the main() method definition.
  • B. Add SerialVersionUID to the Box and Item class.
  • C. Implement the Serializable interface in the Item class.
  • D. Override readObject() and writeObject() methods in the Book class.
  • E. Remove out.flush() method invocation.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ASPushkin
6 months, 1 week ago
Selected Answer: C
C) is the right answer but serialization could be done by the readObject and writeObject methods as well.
upvoted 1 times
...
d7bb0b2
6 months, 4 weeks ago
Selected Answer: C
The correct action to serialize the b1 object is C. Implement the Serializable interface in the Item class. ". In Java, if a class implements Serializable, then all its fields must be serializable as well. If a field is not primitive or does not implement Serializable, then serialization of the class will fail."
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago