• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

serialVersionUID

 
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why some classes ask me for

thanks
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Angus Ferguson wrote:Why some classes ask me for

thanks




Well, no classes "ask" for the variable.

However, some IDE warns you that you have a serializable class without it. The theory behind it is .. if you don't provide it, the Java compiler will generate one based on a formula. And chances are, it will be too volatile, meaning it will change the value even though you don't care about the part that changes.

So... the theory is, if the programmer controls it, then the programmer can change it only when actually needed. This way, if the programmer changes an interim variable, the programmer can choose to not change the ID, and hence, the program will still be compatible with all the previously serialized files.... and of course, this is based on the assumption that the programmer knows what he/she is doing.

Henry
 
reply
    Bookmark Topic Watch Topic
  • New Topic