# Command-Line Argument

A string passed to a Java program when it starts.

## What is **Command-Line Argument** in Java?

**Command-Line Argument** — A string passed to a Java program when it starts.

```java
class Greeter {
    public static void main(String[] args) {
        String firstArgument = args[0];
    }
}
```

Level: Apprentice · [More Java terms at this level](https://www.ask-codey.com/glossary/subjects/java/apprentice)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/command-line-argument
