How To Serialize A Custom Class


  • 22 Jan, 2012

    In this example, we create a custom class, UserInfo which is shown in Code Sample. To make it serializable, it implements the Serializable interface.Code Sample 3: UserInfo.javamport java.io.*;import java.util.*;public class UserInfo implements Serializable { String name = null; public UserInfo(String name) { this.name = name; } public void printInfo() {System.out.println("The name is: "+name); }}

    Comments Received:
    Please give your suggestions and feedback:

2009-2016 downloadmela.com. All rights reserved.