Cant write an Image contained object to a file

HI, I am trying to save Vector object to a file which contains an image as one element.But i am not able to do that can anybody tell how to write the program.

i wrote the following program to do that task but it's not working

can anybody tell what changes i have to make my program to work properly

my code as follows

import java.util.*;

import java.io.*;

import java.awt.*;

class ImageWrit implements Serializable

{

Image img;

public ImageWrit(){

img= Toolkit.getDefaultToolkit().getImage("a9.bmp");

}

}

class A{

public static void main(String s[])

{

FileOutputStream fout;

ObjectOutputStream out ;

Vector list = new Vector();

list.add(new ImageWrit());

try{

fout = new FileOutputStream("a.txt");

out = new ObjectOutputStream(fout);

out.writeObject(list);

System.out.println("object is saved");

}

catch(Exception e)

{

System.out.println("error");

}

}

}

[1053 byte] By [chokkanathana] at [2007-11-27 5:27:25]
# 1
DUPLICATED POSTsee http://forum.java.sun.com/thread.jspa?threadID=5176446&tstart=0
S_i_m_ua at 2007-7-12 14:48:56 > top of Java-index,Core,Core APIs...