import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; class LeseFil { public static void main(String[] args) { Scanner sc = null; try { sc = new Scanner(new File("fil.txt")); } catch (FileNotFoundException fnfe) { System.out.println("Fant ikke filen"); System.exit(-1); } while (sc.hasNextLine()) { System.out.println(sc.nextLine()); } } }