Search code examples
javaappletappletviewer

Two warnings when compiling my java applet


package homework1;

import java.applet.Applet;
import java.awt.Graphics;

public class Homework1A extends Applet {

    public  void paint( Graphics g ){
        g.drawString("CIS 35A Student Learning Outcomes ",40,60);
    }
}

This is the warning that I get

The serializable class Homework1A does not declare a static final serialVersionUID field of type long 
Homework1A.java    /homework1/src/homework1    line 5    Java Problem

also there was another warning like this

Warning: Can't read AppletViewer properties file:

but it disappeared after I run my code a few times.


Solution

  • You'll need a serial version UID such as: private static final long serialVersionUID = 1L; in your class.

    You can use this as reference: Serial IDs