go to previous page   go to home page   go to next page hear noise

Answer:

A 2D geometrical point gives a location using two values, usually an x value and a y value.


The Class Point

Two dimensional grid

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. In Java graphics, the upper left corner of a drawing area (such as a window) is considered to be the origin (0, 0), so y increases going downward.

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 package of predefined classes that are used for building graphical user interfaces, the Application Windowing Toolkit, or the AWT. One of the many classes in the AWT is the class Point.

The class Point describes two things: the variables (the data) and the methods (the behavior) of Point objects.



QUESTION 2:

What two variables do you expect a Point object to have?

Click here for a