Local Variables

In this lesson, we will look at variables that we define and use within the body of a method.

The method changeGreeting

Let’s consider our original version of the class Greeter, as shown in the previous lesson. The class defines two constructors and the method greet. Suppose we want to define an additional method, changeGreeting, that changes the greeting to a string passed to it as an argument. In addition, let’s make the ...