To make a class serializable we do the following:
class A implements Serializable {
transient Object a;
}
And not this:
serializable class A {
transient Object a;
}
Why, if we want to make a class serializable, do we implement a special interface. And if we want to exclude some fields we use the keyword transient
?
Why aren't special keywords used in both cases? I mean were there any reasons to make the same thing in different ways? I know, there is no such keyword as serializable
but why wasn't it introduced instead of the special interface Serializable
?