Java序列化问题
来源:百度知道 编辑:UC知道 时间:2024/05/24 12:44:10
import java.io.Serializable;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.lang.Exception;
public class TestS implements Serializable{
private int width;
private int height;
public void setWidth(int width){
this.width = width;
}
public int getWidth(){
return width;
}
public void setHeight(int height){
this.height = height;
}
public int getHeight(){
return height;
}
public static void main(String[] args){
TestS t = new TestS();
t.setWidth(99);
t.setHeight(88);
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try{
fos = new FileOutputStream("tests.serializable");