File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes SerialsUID Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "SerialsUID" Watch "SerialsUID" New topic


mark I thomas
Ranch Hand

Joined: Apr 07, 2008
Posts: 86
I write a class that implements Serializable. The compiler gave me warning that I did not create a static
serial UID for it. Usign IDE's quick fix, I saw two options -- One is to create a default UID and the other is to create a generated UID.

I chose to create a generated UID and it added a long int to the class. I also tried using a default UID then it added a "1L" to the class.

My question is --- What's the difference between them and is it fine that I chose to use a generated ? Secondly, the default looks so common (1L), wouldn't it be used by other classes as well ? Why does it creates such a common UID (1L) ?
David Newton

Joined: Sep 29, 2008
Posts: 12617

Because it's the default ("version one"), and serial version IDs are unique across a single class.
I agree. Here's the link:
subject: SerialsUID
It's not a secret anymore!