相关疑难解决方法(0)

ObjectInputStream/ObjectOutputStream工作不对

我有类:Client,Server和Background正在使用Player类.我真的不明白为什么我的Client类使用ObjectInputStream/ ObjectOutputStream不能正常工作.

我做得不好?哪里是我的错?

package Shooter2Dv27082013;
public class Player implements Serializable{
....
public int x=10;
public int y=10;
.... }

package Shooter2Dv27082013;
public class Background extends JPanel implements ActionListener, Serializable {
public int countCollisions=0;
private int time = 20;                       // 0.02s
Timer mainTimer = new Timer(time, this);
....
Player p = new Player(); ... }
Run Code Online (Sandbox Code Playgroud)

现在Client类:

package Shooter2Dv27082013;


import javax.swing.*;
import java.net.*;
import java.io.*;

public class Client {
    public static void main(String[] ar) {
        JFrame frame = new …
Run Code Online (Sandbox Code Playgroud)

java sockets serialization objectoutputstream objectinputstream

1
推荐指数
1
解决办法
2137
查看次数