How to serialize a custom class?
Submitted by: AdministratorIn 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.java
mport 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);
}
}
Submitted by: Administrator
Code Sample 3: UserInfo.java
mport 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);
}
}
Submitted by: Administrator
Read Online Socket Programming Job Interview Questions And Answers
Top Socket Programming Questions
☺ | Socket Programming Interview Questions |
☺ | How does the race condition occur? |
☺ | What Is Socket? |
☺ | Socket Programming in C using TCP with Code? |
☺ | What is the difference between TCP and UDP? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |