Generate serialVersionUID of Employee class
import java.io.Serializable;
public class Employee implements Serializable {
private String name;
public
Employee(String name) {
this.name = name;
}
public String
getName() {
return name;
}
}
1. serialver command
JDK has a build in command
called “serialver” to generate the serialVersionUID automatically.
C:\Users\awadh\Desktop>javac
Employee.java
C:\Users\awadh\Desktop>serialver Employee
Employee: private static final long serialVersionUID =
-6607742892470200720L;
Run command:
serialver –show
C:\Users\awadh\Desktop>serialver -show
Put the class
description in the tool and click on the show button.
private static
final long serialVersionUID = -6607742892470200720L;
3. Using Eclipse IDE
No comments:
Post a Comment