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().
3. Description of a Class
Answer:
A point consists of a pair of numbers, (x, y)
.
Description of a Class
The Java documentation describes the class Point
. Look at the documentation on the web to see it. Point (Do a Google search for
"Java Point" if the link fails). You will see something like the following:
The documentation shows the data and methods contained in Point
objects, the constructors that create such objects, and their methods. Variables are sometimes called fields (as is done
here). The two variables are named x
and y
and are of type in
|
Question 3:
There are three constructors listed for Point
. Each one creates the same type of object.
What is the difference between the constructors?