Local Variables
Explore how to define and use local variables within Java methods to manage temporary data. Understand the scope of local variables and their role in returning values while modifying object states in a Java class.
We'll cover the following...
We'll cover the following...
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 ...