import java.io.*; import java.util.StringTokenizer; public class Salakiri{ public static void main(String argumendid[]) throws IOException{ String sonad[]=new String[5]; String tulemused[]=new String[5]; int l=0; BufferedReader sisse=new BufferedReader( new FileReader("Fail.txt") ); String rida=sisse.readLine(); while(rida!=null){ System.out.println(rida); String lause=rida; StringTokenizer tykeldaja=new StringTokenizer(lause); int i=0; while(tykeldaja.hasMoreTokens()){ sonad[i]=tykeldaja.nextToken(); i++; } tulemused[l]=sonad[2]+" "+sonad[3]+" "+sonad[4]+" "+sonad[0]+" "+sonad[1]; PrintWriter valja=new PrintWriter( new FileWriter("TeineFail.txt", true) ); valja.println(tulemused[l]); System.out.println("Kirjutas faili "+tulemused[l]); valja.close(); l++; rida=sisse.readLine(); } sisse.close(); } }