Possible Duplicate:
How to delete stuff printed to console by System.out.println()?
I have a Pickle class that serializes a linked list of words and word counts. Everything works, except that the console doesn't clear when I save and load the data. Even when I leave eclipse and run the program again, the old console output appears along with the new output. Is there anyway to clear the console before loading the object data? Here is my save method:
void save(T obj){
try{
FileOutputStream fos = new FileOutputStream(filename);
ObjectOutputStream out = new ObjectOutputStream(fos);
out.writeObject(obj);
out.close();
}catch(Exception e){
System.err.println(e);
System.exit(1);
}
}
and my load method:
T load(){
try{
FileInputStream fis = new FileInputStream(filename);
ObjectInputStream in = new ObjectInputStream(fis);
temp = (T) in.readObject();
return temp;
}catch(FileNotFoundException f){
System.err.println("Warning! File Not Found. Null is returned");
System.exit(1);
return null;
} catch (Exception e) {
System.err.println(e);
System.exit(1);
return null;
}
}