Commit ca2b5730 by Patryk Czarnik

domyślna ścieżka do pliku

parent d66cee03
...@@ -10,6 +10,10 @@ import java.util.List; ...@@ -10,6 +10,10 @@ import java.util.List;
public class ObslugaCSV { public class ObslugaCSV {
public static List<Employee> wczytaj() {
return wczytaj("pliki/emps.csv");
}
public static List<Employee> wczytaj(String sciezka) { public static List<Employee> wczytaj(String sciezka) {
List<Employee> emps = new ArrayList<>(); List<Employee> emps = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(sciezka))) { try (BufferedReader reader = new BufferedReader(new FileReader(sciezka))) {
......
...@@ -4,7 +4,7 @@ import java.util.List; ...@@ -4,7 +4,7 @@ import java.util.List;
public class P1_WypiszWybranePola { public class P1_WypiszWybranePola {
public static void main(String[] args) { public static void main(String[] args) {
List<Employee> emps = ObslugaCSV.wczytaj("pliki/emps.csv"); List<Employee> emps = ObslugaCSV.wczytaj();
for(Employee emp : emps) { for(Employee emp : emps) {
// System.out.println(emp.getFirstName() + " " + emp.getLastName(); // System.out.println(emp.getFirstName() + " " + emp.getLastName();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment