Print Page Print Page

CH10 – Point Objects And Attributes

  1. Create a new class name PointObject.
  2. Add a main method and add the following code.
import java.awt.Point;
public class PointObject {
  public static void main(String[] args){
    Point blank;
    blank = new Point(3,4);
    System.out.println(blank.toString());
  }
}
  1. Compile and run the program.
$ javac PointObject.java
$ java PointObject
java.awt.Point[x=3,y=4]