
/**
 * Hello-world program to demonstrate Java.
 *
 * @author Ageenko
 * @version 1
 */
public class Hello {
    private String greeting;

    /**
     * Constructor.
     * @param greeting a string used for greeting
     */
    public Hello(String greeting) {
        this.greeting = greeting;
    }

    /**
     * A method that greets given person using standard console.
     * @param person name for the person to greet.
     */
    private void greet(String person) {
        System.out.println(greeting + ", " + person + "!");
    }

    /**
     * Main method
     * @param args <br>1:name of the person to great (optional)
     */
    public static void main(String[] args) {
        Hello hi = new Hello("Hi");
        if (args.length > 0)
            hi.greet(args[0]);
        else
            hi.greet("World");
        System.exit(0);
    }
}

