The near-complete class is below.
Here is the class with a String reference variable included. Of course, you may have used a different name for it.
class HelloObject { String greeting; void speak() { System.out.println( greeting ); } }
The class is not complete because there is no way to initialize the greeting (we will get to this shortly). We would like to see the object used like this:
class HelloTester { public static void main ( String[] args ) { HelloObject anObject = new HelloObject("A Greeting!"); anObject.speak(); } }