1Z0-830 practice question 3 of 25
What interface does a class need to implement to be eligible for serialization?
Full set: 116 questionsTo be eligible for Java's object serialization, a class must implement the java.io.Serializable interface. This is a marker interface, meaning it does not contain any methods that need to be implemented. Its presence simply signals to the Java Virtual Machine's serialization mechanism that instances of the class can be converted into a byte stream and later reconstructed.
B. The Cloneable interface is a marker interface indicating that it is legal for Object.clone() to make a field-for-field copy of instances of that class.
C. ObjectOutputStream is a concrete class used to write serialized objects to a stream; it is not an interface implemented by the objects being serialized.
D. DataOutputStream is a class for writing primitive Java data types to an output stream, not for serializing entire objects.
1. Oracle Corporation. (2023). Serializable (Java SE 21 & JDK 21). Java Platform, Standard Edition 21 API Specification. Retrieved from https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/Serializable.html. (The first sentence of the interface description clarifies its purpose).
2. Oracle Corporation. (2023). Object Serialization (The Java™ Tutorials > Essential Java Classes > Basic I/O). Retrieved from https://docs.oracle.com/javase/tutorial/essential/io/objectstreams.html. (The section "Making a Class Serializable" explicitly states the requirement to implement java.io.Serializable).
Keep practicing
Take the free 1Z0-830 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 1Z0-830 practice questions
- Question 1A consumer needs to access a service provided by another module. Which of the following s…
- Question 2Which of the following statements is TRUE about modules in Java SE 21?
- Question 4What is the primary benefit of encapsulation in Java?
- Question 5A Path object represents which of the following?
- Question 6Which of the following statements about overloaded methods with varargs is TRUE?
- Question 7Which of the following statements is TRUE about static initializers in Java?
