Why does Eclipse warn me to add a serialVersionUID?
Possible Duplicate:
Why should I bother about serialVersionUID?
I've been learning how to use Java's graphics classes. When I made a simple FlowLayout, I got a warning in Eclipse IDE telling me I should add a serialversionUID before my Layout contructor class.
It now looks like:
public class ShowFlowLayout extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
public ShowFlowLayout() {...
What is a serialVersionUID? Is it important to have?
Eclipse asks you to add serialVersionUID
to all serializable classes. Since JFrame implements Serializable
, your class does too, hence it should have a serialVersionUID
. Note that it is not required, only strongly suggested.