ObjectOutputStream problem?

I wish to put an ArrayList Object into a File

Can any one tell me what's problem of following code?

public void writeLFile(ArrayList l,File lfFile)

try

{

ObjectOutputStream leafOut=new

ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(lfFile)));

leafOut.writeObject(l);

leafOut.close();

}

catch (Exception ex){

ex.printStackTrace();

}

}

error is:

java.io.NotSerializableException: floatkd.kddata

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:417)

at floatkd.Dfkdtree.writeLFile(Dfkdtree.java:56)

......

[674 byte] By [pete_he] at [2007-9-26 2:26:18]
# 1
To serialize on objet such an ArrayList (or List or Vector ...) you have to be sure that all the objects contained in the ArrayList are serialisable (implement Serializable interface).What are the classes of the objects in the ArrayList ?Floweb
floweb at 2007-6-29 9:38:58 > top of Java-index,Archived Forums,Java Programming...