Search:

Type: Posts; User: Norm

Search: Search took 0.15 seconds.

  1. Replies
    6
    Views
    1,424

    Re: Cannot print name, getting null error.

    The constructor sets the name to "Scruffy" for each instance of the object that is created. To give the Dog object a different name you need to call the set method.
    Another choice is to add another...
  2. Replies
    6
    Views
    1,424

    Re: Cannot print name, getting null error.

    You have coded Scruffy as a variable. If you want the value of name to be "Scruffy" you need to enclose it in "s.

    What if you have another dog named Spot? How would you create a Dog object with a...
  3. Replies
    6
    Views
    1,424

    Re: Cannot print name, getting null error.

    Is the variable name in the Dog class ever assigned a value? Its default value is null. If the code doesn't assign it a value, its value will be null. Look at the code to see how it can be made to...
Results 1 to 3 of 3