Java Command Line Arguments
Java command line arguments Command line argument is an input or argument to the program when you run the program. In Java, we can take the inputs from the console, and it can be received in the Java program. These inputs are stored as a string array in the main method. Naturally, it is just a method that was used until Scanner function is not introduced. There is no restriction limit of Java command line inputs so that you can specify the n number of inputs. See at the below example Example
class CLexample{ public static void main(String args[]){ System.out.println("first argument= "+args[0]); System.out.println("Second argument= "+args[1]); } }Output

Command Line example for passing many arguments
Example2class CLexample2{ public static void main(String arguments[]){ for(int i=0;i<arguments.length;i++) System.out.println(arguments[i]); } }Output

Parse method
It is a method that takes String as user input and converts it into various forms like Integer, Float, and Double.Types of parse method
There are three types of parse method.- parseInt();
- parseDouble();
- parseFloat();
Integer.parseInt(String s) Float.parseFloat(String s) Double.parseDouble(String s)Example
class CLexample3 { public static void main(String args[]) { int a=Integer.parseInt(args[1]); int b=Integer.parseInt(args[0]); System.out.println(a+5); System.out.println(b+5); } }Output
