Command-line arguments in Java

In Java, you can receive command-line arguments through the main function. Command-line arguments are those arguments which will be passed to a program through command-line.


package com.techstackjournal;

public class Greetings {
	public static void main(String[] args) {
		System.out.println("Good Morning "+args[0]);


java Greetings Earth


Good Morning Earth
See also  How to round to 2 decimal places in Java