The way you are doing this, I presume you need to instantiate SpaceShip. Assuming your class is named SpaceShip, you'd do something like this:
SpaceShip Spaceship1 = new SpaceShip(initialization parameters here);
I'd recommend then creating a function within the SpaceShip class for returning the locations of spaceship ie:
x=Spaceship1.getX();
y=Spaceship1.getY();
Where all these functions do is return SpaceShip1.X-coordinate and SpaceShip1.Y-coordinate respectively. You could make it one function that would return X and Y as well, whatever. I made it like above for simplicity.
You could do this with a static SpaceShip too, but I wouldn't recommend it as it doesn't really fit the paradigm of object oriented programming.







