5 // Purpose: to sum the integers in the file sumit.dat
6 // Author: pc2@ecs.csus.edu or http://www.ecs.csus.edu/pc2
8 // $Id: sumit.java,v 1.2 2005/03/06 05:19:05 laned Exp $
12 public static void main(String
[] args
)
16 RandomAccessFile file
= new RandomAccessFile("sumit.dat", "r");
20 while((line
= file
.readLine()) != null)
22 rv
= new Integer(line
.trim()).intValue();
25 // System.out.println(line);
27 System
.out
.print("The sum of the integers is ");
28 System
.out
.println(sum
);
32 System
.out
.println("Possible trouble reading sumit.dat");
37 // eof sumit.java $Id: sumit.java,v 1.2 2005/03/06 05:19:05 laned Exp $