Skip to content

Commit f2b54fd

Browse files
committed
Iniciar: Leer archivo de texto
0 parents  commit f2b54fd

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

Auxiliar/Andr7st.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Deportivo Cali, mi equipo favorito.
2+
3+
Vamos Cali

src/paquete/Main.java

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package paquete;
2+
/**
3+
* @author Andrés Segura
4+
* @author Andr7st
5+
*
6+
* - Leer un archivo de texto plano.
7+
*/
8+
import java.io.*;
9+
10+
public class Main {
11+
public static void main(String[] args) {
12+
13+
try {
14+
15+
BufferedReader BR = new BufferedReader(new FileReader(new File("../Auxiliar/Andr7st.txt")));
16+
17+
Object[] LI = BR.lines().toArray();
18+
19+
System.out.println("Saltos de Linea: " + LI.length + "\n");
20+
21+
for (Object obj : LI) {
22+
23+
System.out.println(obj);
24+
25+
}
26+
27+
BR.close();
28+
29+
} catch (Exception e) {
30+
31+
System.out.println("No se puede leer la ruta especificada.");
32+
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)