• Post Reply Bookmark Topic Watch Topic
  • New Topic

why "serialVersionUID" is used??  RSS feed

 
Ranch Hand
Posts: 588
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IN a servlet why the parameter is used??

private static final long "serialVersionUID";
 
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jacob,

according to the API documentation the class HttpServlet (not the Servlet interface) implements Serializable and for this it should declare a serialVersionUID. The name for this attribute has to be exactly like this for serialization to find it. It's primarily used by the serialization mechanism in Java to distinguish different versions of a class. So the programmer should change this UID in case of changes to the class if there are already serialized versions of this class used somewhere.

Just search on the web for more information on serialization in Java

Marco
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More details here.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!