If an instance of class Beagle is created, then Serialized, then deSerialized, what is the result?

Given:

import java.io.*;

class Animal {
Animal() {
System.out.print(“a”);
}
}

class Dog extends Animal implements Serializable {
Dog() {
System.out.print(“d”);
}
}

public class Beagle extends Dog {
}

If an instance of class Beagle is created, then Serialized, then deSerialized, what is the result?

Given:

import java.io.*;

class Animal {
Animal() {
System.out.print(“a”);
}
}

class Dog extends Animal implements Serializable {
Dog() {
System.out.print(“d”);
}
}

public class Beagle extends Dog {
}

If an instance of class Beagle is created, then Serialized, then deSerialized, what is the result?

A.
ad

B.
ada

C.
add

D.
adad

E.
Compilation fails.

F.
An exception is thrown at runtime.



Leave a Reply 1

Your email address will not be published. Required fields are marked *