first, Design Ideas:
Design This program we need to take into account the input parameters, and can enter multiple parameters, and for the user to consider the various boundary problems. first, we should give the input parameter statement so that the user can enter it. In the second step, we should output the number of parameters, see if the input parameters, if the parameter is 0, prompting the user to enter a parameter of 0, and then the output of the number of parameters output to the User. The third step is to force the conversion of its arguments with the int type, and then add them with a for loop. The final step is to output the resulting results.
Three: Source Code
Multiple parameter summation problems
zhanxinwu, September 26th,2016.
public class Javaapparguments {
/**
* @param args
*/
public static void main (string[] Args) {
System.out.println ("number of parameters" +args.length);
int sum=0;
For (String Arg:args)
{
Sum=sum+integer.parseint (arg);
}
System.out.println (sum);
}
}
A holistic approach to Java summation