Write a Java program to add two numbers by taking command line arguments.
class CmdLineArgDemo {
public static void main(String[] args) {
int no1 = Integer.parseInt(args[0]);
int no2 = Integer.parseInt(args[1]);
int sum = no1 + no2;
System.out.println("Addition of two numbers is "+sum);
}
}
C:\>javac CmdLineArgDemo.java
C:\>java CmdLineArgDemo 10 21
Addition of two numbers is 31