StackOverflow Error at java.util.AbstractColllection.<init>(Unknown Source)

Posted by thebulge on Stack Overflow See other posts from Stack Overflow or by thebulge
Published on 2013-10-31T03:45:01Z Indexed on 2013/10/31 3:53 UTC
Read the original article Hit count: 164

Filed under:
|

I fixed my prior problem yesterday by just separating all the classes into separate files. Nevertheless, I wrote all the code down and seeing no errors was able to compile the program. Or so I thought.

Here's the error code:

Exception in thread "main" java.lang.StackOverflowError
at java.util.AbstractCollection.<init>(Unknown Source)
at java.util.AbstractList.<init>(Unknown Source)
at java.util.Vector.<init>(Unknown Source)
at java.util.Vector.<init>(Unknown Source)
at java.util.Vector.<init>(Unknown Source

Here are the spots where my I get the errors(marked with problem?)

public class GameWorld implements IObservable, IGameWorld 
{
// create collections class
public Vector<GameObject> GameObjectList = new Vector<GameObject>(); // PROBLEM
private Vector<IObserver> ObserverList = new Vector<IObserver>();
    // declare objects
Tank pTank = new Tank(10, 10);
// other objects and variables to declare 
public GameWorld() 
{
 // add objects to GameObjectList
}
// accessors/mutators
}

I get another error here

public class Tank extends Movable implements ISteerable
     {
 private int armorStrength;
 private int missileCount;
 public Tank()
 {}

 public Tank(int armStr, int misslCt) // problem?
 {
     armorStrength = armStr; // default armorStrength
     missileCount = misslCt; // default missileCount
 }
 public void setDirection(int direction)
 {
    this.setDirection(direction); // get input from left turn or right turn
    // updateValues();
 }
     // access/mutators here

I'm stumped on what to do here.

© Stack Overflow or respective owner

Related posts about java

Related posts about stackoverflow