Hi, I'm new to java and would like to know how to take several command line arguments and sum them . I have done so for two numbers- but don't know how to go on. Thanks
Code:
public class TwoNumbers {
public static void main(String args[]){
int first_number = Integer.parseInt(args[0]);
int second_number = Integer.parseInt(args[1]);
int addition = first_number + second_number;
if(args.length>2){
}
System.out.println("The sum is :"+ addition);
}
}
Comment