èneR: Pointer in Java?

Beitrag lesen

Hallo,
ich habe folgenden Code, der mir "19" ausgibt, statt wie erwartet, "0".
Warum tut er das? Stelle ich mit "a=figs;" eine Art Pointer? Und wenn ja wie unterbinde ich es?

_____________________________________
    public static Figure[] figs = new Figure[6];

public static void main(String[] args) {
        figs[0] = new Figure(1, Color.RED, new Point(0, 0));
        figs[1] = new Figure(2, Color.BLUE, new Point(0, 1));
        figs[2] = new Figure(3, Color.GREEN, new Point(0, 2));
        figs[3] = new Figure(4, Color.YELLOW, new Point(0, 3));
        figs[4] = new Figure(5, Color.WHITE, new Point(0, 4));
        figs[5] = new Figure(6, Color.ORANGE, new Point(0, 5));
        Figure[] a = figs;
        a[0].setX(19);
        System.out.println(figs[0].getX());
    }
_____________________________________
public class Figure {
    int id;
    Color col;
    Point pos;
    public Figure(int id, Color col, Point p) {
        this.col = col;
        this.id = id;
        this.pos = p;
    }

public int getX() {
        return pos.x;
    }

public int getY() {
        return pos.y;
    }

public void setX(int x) {
        pos.x = x;
    }

public void setY(int y) {
        pos.y = y;
    }
[...]
}
_____________________________________

Ich würde mich sehr über eine Antwort freuen, bin fast am verzweifeln!

Grüße,
èneR