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

Answer:

The use count is in the program's output:

Account: 999    Name: Bob       Balance: 35     Use Count: 1
Account: 111    Name: Jill      Balance: 270    Use Count: 4

Default Visibility

If you do not specify public or private for a variable or a method, then it will have default visibility. Default visibility allows a variable or method to be seen by all methods of a class or other classes that are part of the same package. A package is a group of related classes.

For now, default visibility means about the same thing as public visibility. But it is best to explicitly declare members public if that is what you actually need.

You can not explicitly declare a member of a class to have default visibility (for example, you can't say default int monthlyCharge; )

Later on, after these notes have discussed inheritance there will be other visibility modifiers, and additional rules for public and private visibility.


QUESTION 15:

Should a constructor be made public or private?