|
Could a constructor be used a second time to change the values of an object it created? A good answer might be:No. A constructor is used once per object. Once an object has been created the constructor is finished. | |
Dot NotationAfter an object has been constructed it can (usually) be changed by using its own methods (not its constructor.) Some objects are designed so that once they have been constructed they cannot be changed at all. The two types of things inside of an object---variables and methods---are sometimes called members of that object. The members of an object are accessed using dot notation. The example program creates a String object, referred to by the variable str1.
The above is an assignment statement and works in the usual two-step way:
| |
QUESTION 15:Do you think that the following is correct?
Click Here after you have answered the question
|