In an interview, it was asked that there is a class Athat does not implement the interface serializable, as shown below
class A
{
private int a;
A( int a)
{
this.a = a;
}
}
and there is a class Bthat extends Aand also implements the interfaceserializable
class B extends A implements serializable
{
private int a , b;
B(int a, int b)
{
this.a = a;
this.b = b;
}
}
Now, please let me know if I can serialize the class Bor not, if the class is Anot serializable, suppose I want to serialize a class object B, this can be done.
source
share