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");
}
}
}

