A good answer might be:

The near-complete class is below.


Using a Constructor

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();
  }
}

QUESTION 17:

Where in the above code is a constructor being used? What is its parameter?