Java: How to make this Serializable?

前端 未结 3 504
误落风尘
误落风尘 2021-01-18 19:31

I need the following class to be Serializable.

package helpers;

public class XY implements Comparable
{
    public int x;
    public int y;

    p         


        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-18 20:06

    Implementing Serializable will do the trick, but you must write the object with an ObjectOutputStream, not just an OutputStream.

提交回复
热议问题