2023-02-18 14:09:11 +00:00
|
|
|
package aula01;
|
2023-05-31 19:02:14 +00:00
|
|
|
|
2023-02-13 15:56:43 +00:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.nio.file.Files;
|
|
|
|
import java.nio.file.Path;
|
|
|
|
import java.nio.file.Paths;
|
|
|
|
|
|
|
|
|
|
|
|
public class ReadFileExample {
|
|
|
|
|
2023-05-31 19:02:14 +00:00
|
|
|
public static void main(String[] args) {
|
|
|
|
Path fich = Paths.get("datafiles/aula01/major.txt");
|
|
|
|
try {
|
|
|
|
Files.readAllLines(fich).stream().forEach(System.out::println);
|
|
|
|
} catch (IOException e) {
|
|
|
|
System.out.println("Certifique-se que o ficheiro \"major.txt\" está na raiz da pasta do projeto");
|
|
|
|
}
|
|
|
|
}
|
2023-02-13 15:56:43 +00:00
|
|
|
}
|