• Register
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(){
6 5 3
7,540 points

Please log in or register to answer this question.

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

9 7 4
38,600 points

Related questions

0 votes
1 answer 595 views
Problem : I am trying to learn Java, I am very newbie however I wanted to know what I do to get the "run" it. I am facing below error: Static Error: This class does not have a static void main method accepting String[]. Below is my code: public class MyCaneirinho { public static void mycontar ... { System.out.println(j + x + y); } else { System.out.println(j + x + y + z); } } } } // MyCarneirinho
asked Dec 10, 2019 alecxe 7.5k points
0 votes
1 answer 50 views
Problem : In Java, I want to have something as below : class MyClazz<T> {  static void doIt(T object) {    // More code  } } But I face below error &ldquo;Cannot make a static reference to the non-static type T&rdquo; I am unable to understand ... about a subject. Could someone clarify if such the use is possible, by the similar manner? Also, why was my original attempt went unsuccessful?
asked Jan 21, 2020 jwilliam 3.9k points
0 votes
1 answer 9 views
0 votes
1 answer 15 views
Why static and final are not compatible together in Java ?
asked Sep 22, 2020 rm02 310 points
0 votes
1 answer 42 views
Problem: You should not define a class field that is dependent upon the values of other class fields: A) in order to avoid having stale data B) because it is redundant C) because it should be defined in another class D) in order to keep it current
asked Aug 4, 2020 ArifulIslam 5.6k points
0 votes
1 answer 105 views
Problems:- Can any one help with one of the query I am facing in declaring variable type Declare a reference variable of type File named myFile. Any Idea
asked Feb 13, 2020 maddi86 5.4k points
0 votes
1 answer 7 views
Problem: i get error "An object reference is required for the non-static field, method, or property 'text1.Program.method(int, int)'" error An object reference is required for the non-static field, method, or property
asked Dec 3, 2020 Mashhoodch 5.6k points
0 votes
1 answer 5 views
Is there anything I need to do?
asked Dec 30, 2020 TeamScript 9.5k points
0 votes
1 answer 9 views
How can I resolve this error?
asked Dec 28, 2020 TeamScript 9.5k points
2 votes
1 answer 20 views
Problem: Let me thanks to all Kodlogs users first. I found this website very helpful over the internet. I found all the users and their behavior and solutions very helpful. Anyway, I am trying to learn java and I write my very first java program. Unfortunately, my ... using eclipse java as my IDE. Don&rsquo;t know is it the problem of my coding or the IDE. Any legitimate solution is appreciated.
asked Mar 29, 2020 Gavin 15.3k points