I need to be able to read several lines of a .txt with a specific format per line (String, int, int)
for example (Erick, 99,88)
.
After that, make a split of each line, using as a parameter for the split a comma, to be able to operate with the two whole numbers of each line. I went ahead with the following code, but I can only print the 2nd line and I have no idea why.
File file = new File("Calificaciones.txt");
FileReader fileR = null;
BufferedReader file2 = null;
try {
fileR = new FileReader(file);
file2 = new BufferedReader(fileR);
} catch (FileNotFoundException e) {
System.out.println("No se encontro el archivo "+file.getName());
}
try {
while(file2.readLine() != null)
{
String lines = file2.readLine();
System.out.println(lines);
}
} catch (IOException e) {
e.printStackTrace();
}