Advertisement
robeeeert

Untitled

Jun 24th, 2023
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1.     public void MostrarDatosArchivo(){
  2.         try{
  3.             File f = new File ("Datos.txt");
  4.             if (f.exists()){
  5.                     FileReader fr = new FileReader(f);
  6.                     BufferedReader br = new BufferedReader(fr);
  7.                     String linea;
  8.                     while((linea = br.readLine()) !=null){
  9.                         String[] arreglo = linea.split("%");
  10.                         if (arreglo[5].equals("1")){
  11.                         Persona persona = new Persona(arreglo[0], arreglo[1], arreglo[2], arreglo[3],arreglo[4]);
  12.                         System.out.println(persona.toString());
  13.                         }//ifarreglo
  14.                     }//while
  15.                     br.close();
  16.                     fr.close();
  17.                 }//if
  18.             }catch(Exception e){
  19.                 System.out.println("Error de S/E" + e);
  20.             }//TryCatch
  21.         }//FinMostrarDatos
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement