More about Objects and Classes

The relational operations on primitive data are ==, >=, <=, >, <, and !=. They compare two data values, when those values' type has an ordering. For example, integers are ordered by size or magnitude. The result of a relational operation is a boolean value: either True or False. The relational operators on objects like Strings are different, and they are expressed as methods. Pay special attention to the equality method, equals().

6. Picture of the Objects


Answer:

x = 12 and y = 45.

Picture of the Objects

objectsABC

The Points were constructed with the statements

    a = new Point();
    b = new Point( 12, 45 ); 
    c = new Point( b );

The constructor for point a automatically uses (0, 0).

The constructor for point b uses data from its two parameters.

The constructor for point c is given a reference to another point. The x and y values of the new point c will take their values from b as explained in the Point, class documentation.

After the three objects have been created (just before the program closes) the situation looks like the picture.

Each reference variable refers to an object. Each object contains its own data and its own methods.


Question 6:

Look at the picture. Is it clear what the phrase "the object a" means?