String transform(String thePhrase) {
return thePhrase.toUpperCase();
}
String transform(String whatToSay) {
return "Obviously " + whatToSay;
}
class NameDropper extends StringTransformer {
String name; // the persistent storage, a permanent part of each NameDropper
NameDropper(String whatMyNameShouldBe) { // Creation rule (constructor)
this.name = whatMyNameShouldBe;
}
String transform(String whatToSay) { // Transform rule
return this.name + " says " + whatToSay;
}
}