It's not a secret anymore!*
The moose likes Beginning Java and the fly likes Wsad programming question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Wsad programming question" Watch "Wsad programming question" New topic
Author

Wsad programming question

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Hi all,

Sometimes whenever I write any code in Wsad, I get this message at the side of my code.


The Serializable class xyz does not declare a static final serialversionUID field of type long
and gives me an option to add a default serial version id. now, when I click on the option, a new line is added to my code as follows:
private static final long serialVersionUID = 1L;

and I don't know what all this means. Anybody has any idea?

Thanks.


Be Humble... Be Nice.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18538
    
  40

It is a class variable that is used to support versioning, when using serialization. To get full details on how it is used, take a peek at this article about serialization.

http://java.sun.com/developer/technicalArticles/Programming/serialization/

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Thanks Henry I got it now.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Wsad programming question
 
Similar Threads
ArrayList problem ...
Why does Eclipse 3.1.0 show these 2 warnings? any work arounds
extending class with serialVersionUID
object byte array to object instance
eclipseLink vs hibernate