001package horstmann.ch01_helloworld; 002/** 003 A class for producing simple greetings. 004 */ 005 006public class Greeter 007{ 008 /** 009 Constructs a Greeter object that can greet a person or 010 entity. 011 @param aName the name of the person or entity who should 012 be addressed in the greetings. 013 */ 014 public Greeter(String aName) 015 { 016 name = aName; 017 } 018 019 /** 020 Greet with a "Hello" message. 021 @return a message containing "Hello" and the name of 022 the greeted person or entity. 023 */ 024 public String sayHello() 025 { 026 return "Hello, " + name + "!"; 027 } 028 029 private String name; 030}