PDA

View Full Version : مبتدی: The serializable class TimerApplet does not declare a static final serialVersionUID field of type lo



hassan4470
جمعه 14 آبان 1389, 12:26 عصر
من به تازگی دارم برنامه نویسی با جاوارو یاد می‌گیرم و برای نوشتن کدها هم از محیط eclipse استفاده می‌کنم.
من وقتی کد اپلتی رو با جاوا می نویسم eclipse این warning رو نشون میده.
میخواستم بدونم این warning بخاطر چیه؟

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

اینم کدی که نوشتم:


import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;

public class TimerApplet extends Applet implements ActionListener
{
private Button calculate;
private TextArea display;

private long startTime;
private long currentTime;
private long elapsedTime;

public void init()
{
startTime=System.currentTimeMillis(); //Get the current time
//Set up applet interface
calculate=new Button("Watch How time Flys!"); //Button
calculate.addActionListener(this);
display=new TextArea(4,35);
add(calculate);
add(display);
}//init()
public void actionPerformed(ActionEvent e)
{
currentTime=System.currentTimeMillis();
elapsedTime=currentTime-startTime;
display.setText("You have wasted"+elapsedTime+"milliseconds\n"
+"playing with this silly Java applet!!");
}//actionPerformed
}//End of TimerApplet