Parameters And Arguments

Parameters are local names declared by a method. Arguments are the actual values supplied at a call site.

Parameters let one method work with many commands instead of embedding one command and shortcut in its body.

Give a method values

public class Main {
    static void printShortcut(String command, String shortcut) {
        System.out.println(command + " uses " + shortcut);
    }

    public static void main(String[] args) {
        printShortcut("build", "B");
    }
}

Output:

build uses B

The two arguments are matched by position and type with command and shortcut.

Java checks the number, order, and types of arguments against the method's parameter list before the program can run.

Add name and role parameters, then use both values in the badge text.