import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; public class ReadFile { private static String arquivo = "testfile.txt"; private static String cabecalho[]; // Use this to save the persons read from the file private static ArrayList persons = new ArrayList(); public static void main(String[] args) { try { BufferedReader in = new BufferedReader(new FileReader(arquivo)); String str; // Read and parse the file while ((str = in.readLine()) != null) { cabecalho = str.split(","); // For each entry create a new person Person person = new Person(cabecalho[0], Integer.parseInt(cabecalho[1]), cabecalho[2]); persons.add(person); } in.close(); } catch (IOException e) { System.out.println(e); System.exit(-1); } for (int i=0; i