More on Serialization
More questions on Serialization in Java.
We'll cover the following...
We'll cover the following...
1.
Explain the Externalizable interface.
0/500
Show Answer
1 / 2
Technical Quiz
1.
Consider the following class setup:
class Course {
String company;
private Course() { }
Course(String company) {
this.company = company;
}
}
class EducativeCourse extends Course implements Serializable {
public EducativeCourse(String authorName) {
super("Educative");
this.authorName = authorName;
}
private String authorName;
}
Can we serialize the class EducativeCourse ?
A.
Yes
B.
No
1 / 1
Technical Quiz
1.
If we make the parameterless constructor of the super class Course public, the subtype EducativeCourse would become serializable. What would be printed from the following sequence:
// 1. Serialize an object of EducativeCourse
// 2. Deserialize the same object back
// 3. Print the company name like so
System.out.println(object.company)
A.
Educative
B.
empty string
C.
null
1 / 1
Non-static nested classes (inner classes) shouldn't implement the
Serializable...