1 /**
2 A class for producing simple greetings.
3 */
4
5 public class Greeter
6 {
7 /**
8 Constructs a Greeter object that can greet a person or
9 entity.
10 @param aName the name of the person or entity who should
11 be addressed in the greetings.
12 */
13 public Greeter(String aName)
14 {
15 name = aName;
16 }
17
18 /**
19 Greet with a "Hello" message.
20 @return a message containing "Hello" and the name of
21 the greeted person or entity.
22 */
23 public String sayHello()
24 {
25 return "Hello, " + name + "!";
26 }
27
28 private String name;
29 }