Re: writing the object state to a textfile
Thursday, April 15, 2004 03:51 AM
You could serialise the whole object (implement the Serializable interface and then use ObjectOuputStream / ObjectInputStream to write / read it) but this would result in a binary rather than a text file. Or just get each of its attributes and write them out individually. Alternatively, define a toString method for the class that generates a string representation of it with the structure you require and write that out.