My test main class allows user input to create one integer, which I've converted to a string, plus four strings representing details to be written to a file. When these details are written to the file they initially read correctly, eg:

111,hello one,hello two,hello three,hello four

The problem occurs when I try to write a second set if user entry values to this file. It is expecting four strings as words, and therefore reads and writes the above line as follows,


I have absolutely no idea why this is happening and would really appreciate some help or advice with this problem.

The current code for my test main class is as follows,

import simplejava.*;
import videos.*;
import java.io.*;
public class AddTitle {
    public static void main(String[] args) {
        String film, actor1, actor2, director, title;
        int codeNum;
        SimpleReader keyboard = new SimpleReader();
        SimpleWriter screen = new SimpleWriter();
        SimpleReader inFile = new SimpleReader("title_test.txt");
        TitleList titles = new TitleList(inFile);
        codeNum = keyboard.readInt("Title Code for the Film");
        int intValue = codeNum;
        String stringValue = Integer.toString(intValue);
        film = keyboard.readLine("Film Title?");
        actor1 = keyboard.readLine("Lead Actor?");
        actor2 = keyboard.readLine("Supporting Actor?");
        director = keyboard.readLine("Director?");
        titles.add(new Title(codeNum, film, actor1, actor2, director));
        title = inFile.readLine();
        String[] myStrings = title.split(",");
        for (int i=0; i<myStrings.length; i++)
        SimpleWriter outFile = new SimpleWriter("title_test.txt");
Does anybody know why this is happening?

Any help or advice really appreciated!!