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

Answer:

A point consists of a pair of numbers, (x, y).

Description of a Class

In a mathematics book, point is given a precise mathematical definition. For programming, a precise software description of class Point is needed. The Java class libraries come with descriptions of the classes within them. The documentation for Point is found in the Java documentation. Look at the documentation on your hard disk or use Google to see it. You will see something like the following:

public  class  java.awt.Point   

// Fields
int x; 
int y; 

// Constructors
Point();                 // creates a point at (0,0)
Point(int  x, int  y);   // creates a point at (x,y)
Point( Point pt );       // creates a point at the location given in pt

// Methods
boolean equals(Object  obj);  // checks if two point objects hold equivalent data
void move(int  x, int  y);    // changes the (x,y) data of a point object 
String toString();            // returns character data that can be printed

(I've left out some methods we won't be using.)

The documentation shows the data that an object of class Point contains (its variables), the methods that are used to manipulate that data, and the constructors that create objects of that class. Sometimes (as here) variables are called fields. The two variables are named x and y and are of type int.

QUESTION 3:

There are three constructors listed for Point. Each one creates the same type of object. What is the difference between the constructors?