I'm trying to read a txt file on a jframe and I get the following error:
ejava.lang.NumberFormatException: For input string: "andres; rodrigues; [email protected]; 18"
the frame is four columns
private Object[][] leerusuarios() {
Object[][] data;
try {
BufferedReader br = new BufferedReader(new FileReader("usuarios.txt"));
String linea= br.readLine();
int numFilas=Integer.parseInt(linea);
data= new Object [numFilas][4];
for(int i=0;i<numFilas;i++){
linea=br.readLine();
String[] datosUsuario=linea.split(";");
for(int j=0;j<4;j++){
data [i][j]=datosUsuario[j];
System.out.println(br.readLine());
br.close();
...
} catch (IOException ex) {
System.out.println(ex.getMessage());
data= new Object[0][4];
}
return data;
}
Archivo usuarios.txt:
andres;rodrigues;[email protected];18 juan;hernandes;[email protected];20 maria;castro;[email protected];30 david;peña;[email protected];26