Write a program to accept a string as command line argument and print the same.
Sample Input (Command Line Argument) 1:
Programming
Sample Output 1:
Programming – Command Line Arguments
Sample Input (Command Line Argument) 2:
Arguments
Sample Output 2:
Arguments – Command Line Arguments
Solution
class Main
{
public static void main(String args[])
{
System.out.println(args[0]+" - Command Line Arguments");
}
}Happy Learning – If you require any further information, feel free to contact me.
![[Solved] Command Line Argument Print String with Java [Solved] Command Line Argument Print String with Java](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Command-Line-Argument-Print-String-with-Java.png)
![[Solved] Auditions with Java, C++](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Auditions-with-Java-C-300x200.png)
![[Solved] Command Line Argument Square with Java, C++](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Command-Line-Argument-Square-with-Java-C-300x200.png)
![[Solved] Nice Number with Java, C++, Python](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Nice-Number-with-Java-C-Python-300x200.png)