3 Replies - 664 Views - Last Post: 05 March 2011 - 09:49 AM Rate Topic: -----

#1 coolbeans777  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-February 11

Java Serializable Class Help?

Posted 04 March 2011 - 10:23 AM

Hey, I was learning Swing via Swing Tutorial Part II earlier http://www.dreaminco...torial-part-ii/, and when I typed line 13 from the first code into eclipse, it said that it didn't contain a static final serialVersionUID field of type long. Why do I need to put this code in and what should I put in for the actual serial number???

Is This A Good Question/Topic? 0
  • +

Replies To: Java Serializable Class Help?

#2 masijade  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 196
  • View blog
  • Posts: 580
  • Joined: 03-April 10

Re: Java Serializable Class Help?

Posted 04 March 2011 - 11:13 AM

It is a number that identifies the "version" of the class. When the server serves an instance of this class to the client, the client checks that it's version matches the version of that from the server to ensure compatability. You do not have to provide one. If you don't the server will generate one, based on the class definition, and the client will also generate one, based on its class definition, and will compare those.
Was This Post Helpful? 1
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8343
  • View blog
  • Posts: 31,890
  • Joined: 06-March 08

Re: Java Serializable Class Help?

Posted 04 March 2011 - 06:40 PM

I usually put, as an long: YYMMDDHHMML
It garanties uniqness within my classes and also makes a timestamp of when I wrote the class for the first time
As I do not more than a class per minute the numbers stay unique
Was This Post Helpful? 1
  • +
  • -

#4 coolbeans777  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-February 11

Re: Java Serializable Class Help?

Posted 05 March 2011 - 09:49 AM

Ight, Thanks guys
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1