Question: Java language. Create the following Java command line iterator application Lab4. Pass in three arguments when the program starts. For example java Lab4 4 3
Java language.
Create the following Java command line iterator application Lab4. Pass in three arguments when the program starts.
For example java Lab4 4 3 5
The command line arguments get passed into the main method as a String array in the variable object named args. Remember they get passed in as strings so you need to parse them into integers using the Integer.parseInt(args[X]) before you can treat them as integers. Create four sections that perform the following functions.
- Create a for loop iteration structure: loop the number of times of args[0] passed in, printing the counter value each time to the command line
- Create while loop iteration structure: loop the number of times of args[1] that was passed in, printing the counter value each time to the command line
- Create a do loop iteration structure: loop the number of times of args[2] that was passed in, printing the counter value each time to the command line
- Create a for each iteration structure to iterate through the args[] array printing the value in each element to the command line screen
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
