1. Design Ideas
The first thing to know is the meaning of entering numbers from the command line, which you don't need to define in your program. You need to define NUM and sum for the int class. After that, Num=integer.parseint (ARG) is used and the string type is converted to int type. The For loop is then used to add num to the sum in turn.
2. Program Flowchart
3. Source code
public class Word {
Letter 1603 20163535 Liu School speech
public static void Main (string[] args) {
TODO auto-generated method stubs
System.out.println ("Number of parameters" +args.length);
int num;
int sum=0;
for (int i=0;i<args.length;i++)//Loop
{
Num=integer.parseint (Args[i]);//cast string argument to int type
Sum=sum+num;
}
System.out.println ("Several numbers combined with" +sum);//Output
}
}
4. Running
Receive multiple numbers from the command line with the Java implementation and then output the result after summing