Question: Java please Write a complete main method that does the following 1. Takes any number, but at least two, command line arguments which are numbers
Write a complete main method that does the following 1. Takes any number, but at least two, command line arguments which are numbers (represented as strings) and calculates the sum, printing the answer to the console. (Hint: loop through the args array) 2. If there are not at least two command line arguments, throw an IllegalArgumentException with an appropriate message For example, C:>java Question1 15 6 2 12 10 100 The sum is 145. public class Question1 i public static void main (String args[]) f ) //main )I/ class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
