Java Swing Tutorial - Java Point.getY()








Syntax

Point.getY() has the following syntax.

public double getY()

Example

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

/*from  w  ww .  j  a  v a  2  s. c  o m*/
import java.awt.Point;


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

The code above generates the following result.