import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Filehandler { public void readFile() { File file = new File("adat.txt"); try(Scanner sc = new Scanner(file)){ while(sc.hasNext()) { String line = sc.nextLine(); System.out.println(line); } }catch(FileNotFoundException e) { System.err.println("Hiba! A fájl nem található"); System.err.println(e.getMessage()); } } }