multiple save options

Hi. I came up with a simple text file saving kind of a logic. But I want to enable it to let multiple saves such that each time it is saved, the information in the previous file remains intact. Can someone help me to modify the program? Thanks alot !

import java.io.*;

public class save {

String a;

String b;

int c;

int d;

int e;

int f;

int g;

int h;

public save(String a, int b) throws IOException {

this.a = a;

this.b = b;

File outputFile = new File("game1.txt");

FileOutputStream out = new FileOutputStream(outputFile);

PrintStream fileOutput = new PrintStream(out);

fileOutput.println(a + ";" + Integer.toString(b) + ";");

out.close();

}

}

[784 byte] By [mightystone] at [2007-9-30 4:53:18]
# 1
In other words, I want it to work in such a way that when the player saves, another textfile or a different name is being created.
mightystone at 2007-7-1 15:08:47 > top of Java-index,Other Topics,Java Game Development...
# 2

oops sorry. a little mistake here..

import java.io.*;

public class save {

String a;

int b;

public save(String a, int b) throws IOException {

this.a = a;

this.b = b;

File outputFile = new File("game1.txt");

FileOutputStream out = new FileOutputStream(outputFile);

PrintStream fileOutput = new PrintStream(out);

fileOutput.println(a + ";" + Integer.toString(b) + ";");

out.close();

}

}

mightystone at 2007-7-1 15:08:47 > top of Java-index,Other Topics,Java Game Development...
# 3

huh? try this:

import java.io.*;

public class save {

String a;

int b;

private static counter = 0;

public save(String a, int b) throws IOException {

this.a = a;

this.b = b;

counter++;

File outputFile = new File("game" + counter + ".txt");

FileOutputStream out = new FileOutputStream(outputFile);

PrintStream fileOutput = new PrintStream(out);

fileOutput.println(a + ";" + Integer.toString(b) + ";");

out.close();

}

}

javaweird at 2007-7-1 15:08:47 > top of Java-index,Other Topics,Java Game Development...