可能重复:
什么是 serialVersionUID,我为什么要使用它?
servlet(私有静态最终长序列版本UID = 1L)中的含义是什么?
我有一个关于我们教授给出的指导计划的简单问题。我已经多次看到serialVersionUID,但我不知道那是什么。
package module;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author JA
*/
public class Servlet_1 extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet{
static final long serialVersionUID = 1L;
public void doGet (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("txt/html");
ServletOutputStream out = response.getOutputStream();
out.println("<html>");
out.println("<head><title>Hello Panget</title></head>");
out.println("<body>");
out.println("<h1>Hello Panget</h1>");
out.println("</body></html>");
}
protected void doPost (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// Write your program here, Panget.
}
}
在程序中有什么用static final long serialVersionUID = 1L;
?