public class Contact implements Serializable {
private String name;
private String email;
public String getName() {
return name;
}
publ
Implement the Serializable interface when you want to be able to convert an instance of a class into a series of bytes or when you think that a Serializable object might reference an instance of your class.
Serializable classes are useful when you want to persist instances of them or send them over a wire.
Instances of Serializable classes can be easily transmitted. Serialization does have some security consequences, however. Read Joshua Bloch's Effective Java.