I am trying to append some information into a text file, but the file only shows the last element written.
There are many Engineer
s, but it prints to th
I don't see where you are closing the file. I don't see you reading anything either.
I assume you want to append to the file instead of overwriting it each time. In that case you need to use the append option of FileOutputStream as this is not the default behaviour.
PrintStream writetoEngineer = new PrintStream(
new FileOutputStream("Engineer.txt", true));
BTW: e.toString() + " "
is almost the same as e + " "
except it doesn't throw an exception if e is null.