Java smart way of declaring locals
<p>Suppose I have </p>

<pre><code>public abstract class Collision { 
public static MapObject getNorth(GameCharacter gc) {
    // ..other stuff, probably shares more local variables and gc-states
    int x = gc.getX();
    int y = gc.getY();
    // ...dostuff before return
    return gc;
}

public static MapObject getSouth(GameCharacter gc) {
    // ..other stuff, probably shares more local variables and gc-states
    int x = gc.getX();
    int y = gc.getY();
    // ...dostuff before return
    return gc;
}

public static MapObject getWest(GameCharacter gc) {
    // ..other stuff, probably shares more local variables and gc-states
    int x = gc.getX();
    int y = gc.getY();
    // ...dostuff before return
    return gc;
}

public static MapObject getEast(GameCharacter gc) {
    // ..other stuff, probably shares more local variables and gc-states
    int x = gc.getX();
    int y = gc.getY();
    // ...dostuff before return
    return gc;
}

public static MapObject getNeighbor(GameCharacter gc, int dx, int dy) {
     // Moving east
    if (dx == 1) {
        return getEast(gc);
    }
    // Moving west
    if (dx == -1) {
        return getWest(gc);
    }
    // Moving south
    if (dy == 1) {
        return getSouth(gc);
    }
    // Moving north
    if (dy == -1) {
        return getNorth(gc);
    }
    return gc;

}
</code></pre>

<p>Now the four methods on top will end up sharing a lot of local variables and gc-states. Only one method may be called at any time. Now I feel very stupid having designed it like this to increase readability (so we don't get lost coding our own game...) and to make things simpler at the cost of having to define the same variables in 4 different methods. There are other methods to this abstract class and all of the methods will end up sharing at least 4-5 variables. Will I have to forego my abstract implementation or is there a way to design a constructor for this class without inheriting from it (and calling super())?</p>

<p>The design may seem puzzling to you, we are new to java, this is not final, we are just experimenting at this stage. It seemed like a good idea to have the logic of the game be abstract (much like Math is in java).</p>
