A 2D geometrical point gives a location using two values, usually an x value and a y value.
Point
Think of a two dimensional point as an object that consists of two values, the distance x from the origin along a horizontal axis, and the distance y from the origin along a vertical axis:
It is convenient to think of a point as a single thing (not as two separate things). For example, you think of the end point of a line as one thing. And you think of the corner of a square as one thing. This is an example of abstraction. In Java, an abstraction usually calls for a class.
Java comes with a library of predefined classes
that are used for building graphical
user interfaces.
This library is called the Application Windowing Toolkit, or the AWT.
One of the many classes defined in this library is the class Point
.
A class (recall) is a description of a possible object.
A class library is a collection of such descriptions.
The class Point
describes two things:
the variables (the data)
and the methods (the behavior)
of Point
objects.
What two variables do you expect a Point
object to have?