Παράδειγμα: Point

class Point {
  // Public fields
  public int x, y;
  private boolean visible;
  private int serialNumber;
  // Private method
  private void setpos(int sx, int sy) {
    x = sx;
    y = sy;
  }
  // Public methd
  public void moveToCenter() {
    setpos(0, 0);
  }

}