Monday, May 13, 2002 02:16 PM
you can write TreeNode object into a file with the following steps.
1.Implement Serializable interface for the TreeNode Program.
2.Write a method which saves the tree node Object
FileOutputStream fos = new FileOutputStream(filename);
ObjectOutputStream oos = new ObjectOutputStream(fos);
U can create the file (filename) manully or programatically.
Then call this method in the tree node program at all such points where the exit of the program is possible.
3.Write a method which reads the object
FileInputStream fin = new FileInputStream(filename);
ObjectInputStream ois = new ObjectInputStream(fin);
tObject = (TreeNode)ois.readObject();
call this method to see the previous object.