Computer Science, asked by bhavani04sony, 8 months ago

Write a Program that accepts two Strings as command line arguments and generate the output in the required format.

Example1)
If the two command line arguments are Wipro and Bangalore then the output generated should be Wipro Technologies Bangalore.

Example2)
If the command line arguments are ABC and Mumbai then the output generated should be ABC Technologies Mumbai

Answers

Answered by ridhimakh1219
34

Write a Program that accepts two Strings as command line arguments and generate the output in the required format.

Explanation:

Java program to show the use of Command Line Arguments

public class Main

{

 public static void main(String args[])

 {

  System.out.println(args[0] + " Technologies " + args[1]);

 }

}

compilation :  javac Main.java

execution : java Wipro Bangalore

Output 1

Wipro Technologies Bangalore

compilation :  javac Main.java

execution : java ABC Mumbai

Output 2

ABC Technologies Mumbai

Note

Two Command line Arguments are ABC Mumbai and these values are stored in an array args[] of type string and these arguments passed to the main function. To print that values, args[0] and args[1] are used by concatenating the string "Technologies" in between them.

Similar questions