import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Fil { public static void main(String[] args) throws FileNotFoundException { Scanner scanner = new Scanner(new File("minfil.txt")); while (scanner.hasNextLine()) { String linje = scanner.nextLine(); String[] ord = linje.split(" "); for (int i = 0; i < ord.length; i++) { System.out.println("INDEKS: " + i + " ORD: " + ord[i]); } } } }