public static void w() {
try{
ObjectOutputStream oo = new ObjectOutputStream(
new FileOutputStream("c:/a.bin"));
Integer[] i = new Integer[]{new Integer(3),new Integer(2),new Integer(1)};
Boolean b = new Boolean(true);
oo.writeObject(i);
oo.writeObject(b);
oo.close();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void r() {
try{
ObjectInputStream oo = new ObjectInputStream(
new FileInputStream("c:/a.bin"));
Integer[] ii = (Integer[])oo.readObject();
for(int i = 0; i<ii.length;i++)
System.out.print(ii[i]+"  ");
Boolean b = (Boolean)oo.readObject();
System.out.println("\n"+b);
} catch(Exception e) {
e.printStackTrace();
}
}

解决方案 »

  1.   

    File file = fc.getSelectedFile();
                        try {
                        FileWriter out = new FileWriter(file);
                        out.write(bm.counterStep);
                        out.write(bm.currentStep);
                        for (int i = 0;i<65535;i++) {
                         for (int j =0;j<20;j++) {
                         out.write(bm.memoryState[i][j]);
                         }
                        }
                        out.close();
                        }我用这种方法,为什么就写不进去呢?