/* du livre "Just Java" par Peter van der Linden voir aussi: http://java.sun.com/people/linden/faq_b2.html#I/O */ import java.io.*; import java.util.*; public class exo5 { public static void main(String args[]) { try { RandomAccessFile f = new RandomAccessFile ("data.txt", "r"); String s; while ( (s=f.readLine()) != null ) { System.out.println("read: "+s); StringTokenizer st = new StringTokenizer(s); int i=0; while (st.hasMoreTokens()) { i = Integer.parseInt(st.nextToken()); // i now holds the next int on the line // could also use Double.parseDouble(), etc. System.out.print(" "+ i); } System.out.println(); } } catch (Exception e) {System.out.println("Excpn: "+e); } } }