gpt4 book ai didi

java - 编译我的java小程序时出现两个警告

转载 作者:行者123 更新时间:2023-11-30 04:38:55 25 4
gpt4 key购买 nike

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);
}
}

这是我收到的警告

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

还有另一个类似的警告

Warning: Can't read AppletViewer properties file:

但在我运行代码几次后它就消失了。

最佳答案

您的类中需要一个串行版本 UID,例如:private static Final long serialVersionUID = 1L;

您可以将此作为引用:Serial IDs

关于java - 编译我的java小程序时出现两个警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12774440/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com