日期:2014-05-20  浏览次数:20813 次

急,急:这个警告是什么意思--The serializable class chatClient does not declare a static final serialVersionUID field of
我是用一个eclipse来编一个client/server程序,为何在Client程序中出现上述这个警告  


我的Client   程序是
import   java.io.*;
import   java.net.*;
import   java.awt.*;
import   java.awt.event.*;

public   class   chatClient   extends   Frame   {

Socket   s   =   null;

DataOutputStream   dos   =   null;

TextField   texfid   =   new   TextField();

TextArea   taContent   =   new   TextArea();

public   void   launchFrame()   {
setLocation(300,   300);
this.setSize(400,   400);
add(texfid,   BorderLayout.SOUTH);
add(taContent,   BorderLayout.NORTH);
pack();
this.addWindowListener(new   WindowAdapter()   {
public   void   windowClosing(WindowEvent   e)   {
System.exit(0);
disconnect();

}

});
texfid.addActionListener(new   TFListener());
setVisible(true);
connect();
}

public   void   connect()   {
try   {
s   =   new   Socket( "127.0.1.1 ",   8888);
System.out.println( "connected ");
}   catch   (UnknownHostException   e)   {
e.printStackTrace();
}   catch   (IOException   e)   {
e.printStackTrace();
}

}

public   void   disconnect()   {
try   {
dos.close();
}   catch   (IOException   e)   {
e.printStackTrace();
}

}

private   class   TFListener   implements   ActionListener   {

public   void   actionPerformed(ActionEvent   e)   {
String   str   =   texfid.getText().trim();
taContent.setText(str);
texfid.setText( " ");
try   {
dos   =   new   DataOutputStream(s.getOutputStream());
dos.writeUTF(str);
dos.flush();
}   catch   (IOException   e1)   {
e1.printStackTrace();
}

}

}

public   static   void   main(String[]   args)   {
new   chatClient().launchFrame();
}

}


我的Server程序是:
import   java.net.*;
import   java.io.*;

class   chatServer2   {
boolean   bConnected=false;
DataInputStream   dis=null;

public   static   void   main(String[]   args)   {
new   chatServer2().start();
}
public   void   start(){
ServerSocket   ss=null;
try   {
      ss=new   ServerSocket(8888);
bConnected=true;
}catch(BindException   eb){
System.out.println( "port   in   use..... ");
System.out.println( "please   close   other   program   and   continue ");
}catch(IOException   ei){
ei.printStackTrace();
}
try   {
Socket   s   =   ss.accept();
client   c=new   client(s);
new   Thread(c).start();
}   catch   (IOException   e)   {
e.printStackTrace();
}finally{
try   {
ss.close();
}   catch   (IOException   e)   {