Subida de Actividad 1.1 Investigación sobre Ficheros y tratamiento I de Marcos Alcalde
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,28 @@
|
|||||||
|
package org.palomafp.aadd.mag;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class Fichero_01 {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
File archivo = new File("C:\\Users\\alumnoT\\aadd\\fic01\\informacion_paises.txt");
|
||||||
|
|
||||||
|
try (BufferedReader br = new BufferedReader(new FileReader(archivo))) {
|
||||||
|
String linea;
|
||||||
|
System.out.println("Leyendo fichero de datos...");
|
||||||
|
|
||||||
|
while ((linea = br.readLine()) != null) {
|
||||||
|
if (linea.startsWith("#") || linea.trim().isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Línea leída: " + linea);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("Error al leer el fichero: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user