• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2687
  • Last Modified:

example.java:19: warning: [serial] serializable class example has no definition of serialVersionUID

example.java:19: warning: [serial] serializable class example has no definition of serialVersionUID
public class example extends JFrame implements ActionListener

I am getting this warning messsage. how do i get rid of it..thanks
0
zizi21
Asked:
zizi21
  • 2
  • 2
2 Solutions
 
willyRDCommented:
You can add a constant implementing it to your code (I know your're probably never going to use it, but the warning message will disappear):

public class Test extends JFrame implements ActionListener{

      private static final long serialVersionUID = -3088001842L;

      ....
}
0
 
Ajay-SinghCommented:
Theoretically, all the classes that directly/indirectly implement Seriliable
interface should have serialVerionUID. IDEs like eclipse, show this as
warning if its not there.
 
More on javadocs here:
http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html
0
 
zizi21Author Commented:
hi, btw, if i dont implement it, woudl anything happen to my program?
0
 
willyRDCommented:
That depends, if you are going to serialize/deserialize your class then you may find problems. If you're not going to serialize/deserialize then ypu'r not going to have any problem, except for the Eclipse warning.
0
 
zizi21Author Commented:
thanks:)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now