5 * $Id: SumArgs.java,v 1.1 2008/04/03 16:21:06 rmh3093 Exp rmh3093 $
8 * $Log: SumArgs.java,v $
9 * Revision 1.1 2008/04/03 16:21:06 rmh3093
18 public class SumArgs
{
21 * Sum up all integer command line arguments
23 * @param args Integers to sum
25 public static void main(String
[] args
) {
29 for (String s
: args
) {
31 sum
+= Integer
.parseInt(s
);
32 } catch (NumberFormatException e
) {
33 System
.err
.printf("Bad integer: For input string: \"%s\"\n",s
);
37 System
.out
.printf("The sum of the arguments is: %d\n", sum
);