import java.util.Scanner; import java.io.*; class ScannerTest { public static void main(String[] args) { Scanner sc = null; try { sc = new Scanner(new File("tall.txt")); } catch (FileNotFoundException e) { System.out.println("Fant ikke filen!"); System.exit(-1); } while (sc.hasNextLine()) { String[] tall = sc.nextLine().split(" "); int teller = 0; for (int i = 0; i < tall.length; i++) { teller += Integer.parseInt(tall[i]); } System.out.println(teller); } } }