Reading a line from a text file and splitting its contents I have this kind of file structure


MALE:FooBar:32
FEMALE:BarFoo:23



Where I would want to identify the gender and age of person, &lt;Gender&gt;:&lt;Name&gt;:&lt;age&gt;

try{
    BufferedReader in = new BufferedReader(new FileReader("people.ser"));
    String s;

    while((s = in.readLine()) != null){

        String[] var = s.split(":");
             //var[0]=MALE etc etc
        addGender.add(var[0]);
    }

}catch(Exception e){
    e.printStackTrace();
}



Is using a delimiter (like a : in this case) to split string considered a bad practice? 
What about using the array from the splitted string to store it in some place? 
Are there any alternatives and better file structure?
I don't think that using : is a bad practice but you have to escape it somehow if it occurs inside your data. Anyway, I'd consider using XML or JSON here.

Some notes about the code:


You should close the stream (in a finally block). See Guideline 1-2: Release resources in all cases in Secure Coding Guidelines for the Java Programming Language
The .ser file extension is often used for serialized Java objects. I'd use something else to avoid the possible confusion.
It's a good practice to set the character set when you read a text file. The used FileReader always uses the default charset which could vary from system to system. Consider using InputStreamReader and FileInputStream as the documentation of FileReader says. Here is an example:

FileInputStream fileInputStream = null;
InputStreamReader inputStreamReader = null;
BufferedReader bufferedReader = null;
try {
    fileInputStream = new FileInputStream("people.dat");
    inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8");
    bufferedReader = new BufferedReader(inputStreamReader);

    // use BufferedReader here
} finally {
    IOUtils.closeQuietly(bufferedReader);
    IOUtils.closeQuietly(inputStreamReader);
    IOUtils.closeQuietly(fileInputStream);
}


It uses IOUtils from Apache Commons IO and closes the FileInputStream even if the constructor of InputStreamReader or BufferedReader throws an exception.