go to previous page   go to home page   go to next page

Answer:

A reference to the message is kept in one of the object's variables.


Improved Class

Here is a start on improving HelloObject:

class HelloObject                                  
{                                                  

  private  ;   // reference variable for the object's message

  // Constructor will go here
  
  // A public method
  public void speak()                                     
  { 
    System.out.println(    );   // print the object's message
  }
}

QUESTION 16:

Modify the definition of HelloObject to include a String reference variable. Modify the speak() method so that it uses that variable.

(For now, don't write a constructor. We'll do that later.)


go to previous page   go to home page   go to next page