01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package horstmann.ch01_helloworld;
/**
   A class for producing simple greetings.
 */

public class Greeter
{
  /**
      Constructs a Greeter object that can greet a person or
      entity.
      @param aName the name of the person or entity who should
      be addressed in the greetings.
   */
  public Greeter(String aName)
  {
    name = aName;
  }

  /**
      Greet with a "Hello" message.
      @return a message containing "Hello" and the name of
      the greeted person or entity.
   */
  public String sayHello()
  {
    return "Hello, " + name + "!";
  }

  private String name;
}