Hi there,
at the moment i am doing some research to Genetic Programming. I have implemented some expression trees ((a + b) * c) but have some problems printing the tree. Therefor i use a recursive method like tihs:

public void printInOrder(){
if(left != null){
System.out.print(" (");
System.out.print(" " + op);
if(right != null){
System.out.print(" )");

Left and Right represent the Left-node and the Right-node of a Root-node. Look at the example function, the root is '*' and the left is a '+' and the right a 'c' etc..

/ \
+ c
/ \
a b

This works perfect and i have no problems printing the tree. The output is just as i wanted: (a + b) * c. But now i want everything to print to some output-file to save my trees. The problems is that the recursive method overwrites my file everytime it starts this method and therefor i only see the last part of the tree in the output-file.

Can someone say how i can print my trees without overwriting the output-file?

thnx Tindo