import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
public class App {
public static void readFile() {
try {
tryReadFile();
} catch (IOException e) {
System.err.println("Hiba! A fájl nem olvasható!");
}
}
public static void tryReadFile() throws IOException {
Path path = Paths.get("employees.txt");
Charset cs = StandardCharsets.UTF_8;
List<String> lines = Files.readAllLines(path, cs);
lines.forEach( line -> {
String[] rows = line.split(":");
System.out.println(rows[0]);
});
}
public static void main(String[] args) throws Exception {
readFile();
}
}