code: public static Point closestPoint(Geometry geomA, Geometry geomB) {
          if (geomA == null || geomB == null) {
              return null;
          }
          // Return the closest point on geomA. (We would have used index
          // 1 to return the closest point on geomB.)
          return geomA.getFactory().createPoint(DistanceOp.nearestPoints(geomA, geomB)[0]);
      }
docs: Returns the 2D point on geometry A that is closest to geometry B.
  
  @param geomA Geometry A
  @param geomB Geometry B
  @return The 2D point on geometry A that is closest to geometry B