Programmers learn & share
0 votes

Problem :

I am having following warning message.

The serializable class does not declare a static final serialversionuid field of type long

I would like to understand and resolve the issue. Can somebody explain me this issue with simple words? I know what OOPs is

Please find below my code for your reference :

import java.awt.*;
import javax.swing.*;
public class HelloSwing extends JFrame {
JTextArea m_resultArea = new JTextArea(6, 30);
public HelloSwing() {
//... Set initial text, scrolling, and border.
m_resultArea.setText("Enter some more text to see scrollbars");
JScrollPane scrollingArea = new JScrollPane(m_resultArea);
// Get the content pane, set layout, add to center
Container content = this.getContentPane();
content.setLayout(new BorderLayout());
content.add(scrollingArea, BorderLayout.CENTER);
public static void createAndViewJFrame() {
JFrame win = new HelloSwing();
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable(){
public void run(){
by (7.5k points)   | 65 views

1 Answer

0 votes

Solution :

Please find below the solution on your problem :

You can configure your IDE in two ways:

·To ignore the error message instead of giving a warning.

·To auto generate an id

It can cause the problem only if you are serializing objects and deserializing them in a different place OR time where the class has changed, and it will not result in freezing, but in InvalidClassException

by (36.1k points)  
2,245 questions
2,807 answers
241 users