Java Swing Tutorial - Java Point() Constructor








Syntax

Point() constructor from Point has the following syntax.

public Point()

Example

In the following code shows how to use Point.Point() constructor.

import java.awt.Point;
//  ww w  . ja  va 2s .c  o  m

public class Main {
  public static void main(String[] args) {
    Point p = new Point();
    
    p.setLocation(2.3D,3.3D);
    System.out.println(p.getLocation());
  }
}

The code above generates the following result.