A reference to the message is kept in one of the object's variables.
Here is what we have so far for HelloObject
:
class HelloObject { void speak() { System.out.println("Hello from an object!"); } }
Here is a start on improving HelloObject:
Modify the definition of HelloObject
to include a String
reference variable.
Modify the speak()
method so that
it uses that variable.