|
Do you thing that all objects of the same type are the same size? A good answer might be:No. Objects are bigger and more complicated than primitive data types. It would be too restrictive if all objects of the same type had to be the same size. | |
A String ObjectSince objects are big, complicated, and vary in size you DO NOT automatically get an object when you declare an object reference variable. All you get is a name for a future object. Examine the following:
An object contains data and methods (state and behavior). You can visualize the String object in the above program like this:
The data section of the object contains the characters. The methods section of the object contains many methods. (Actually, this picture is a simplification. The Java system does something more efficient, but logically equivalent.) In future diagrams showing objects, the methods of the object will usually not be shown. | |
QUESTION 4:
(Review:) What does the following
Click Here after you have answered the question
|