Μέθοδοι κατασκευής: παράδειγμα

class Point {
    /* Fields */

    /** Point x coordinate */
    private int x;
    /** Point y coordinate */
    private int y;

    /* Methods */
    /** Default constructor */
    Point() { x = y = 0; }
    /** Constructor with coordinates */
    Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
}