java.util.AbstractCollection处的堆栈溢出错误。<;初始化>;(来源不明)
昨天我通过将所有类分离到单独的文件中,解决了之前的问题。尽管如此,我还是写下了所有的代码,没有发现任何错误,因此我能够编译程序。至少我是这么想的 以下是错误代码:java.util.AbstractCollection处的堆栈溢出错误。<;初始化>;(来源不明),java,stack-overflow,Java,Stack Overflow,昨天我通过将所有类分离到单独的文件中,解决了之前的问题。尽管如此,我还是写下了所有的代码,没有发现任何错误,因此我能够编译程序。至少我是这么想的 以下是错误代码: Exception in thread "main" java.lang.StackOverflowError at java.util.AbstractCollection.<init>(Unknown Source) at java.util.AbstractList.<init>(Unknown Sour
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
我不知道在这里该怎么办
这是主要代码
public class Starter {
public static void main (String args[])
{
Game g = new Game();
}
}
它有一个游戏类,基本上是程序的GUI
public class Game extends JFrame {
private GameWorld gw;
private MapView mv; // new in A2
private ScoreView sv; // new in A2
公共游戏({
并且有很多其他函数的引用。发布你的
main
方法。似乎你在使用递归,它永远不会结束,导致堆栈溢出。请发布你的main方法。public class Starter{public static void main(String args[]){Game g=new Game();}
@thebulge,你的主页中就只有这些了吗?
?请在你的帖子中发布所有内容,不要作为评论。只需编辑你的帖子。链接就在所谓的标签下方。对此,我深表歉意。
public class Starter {
public static void main (String args[])
{
Game g = new Game();
}
}
public class Game extends JFrame {
private GameWorld gw;
private MapView mv; // new in A2
private ScoreView sv; // new in A2
gw = new GameWorld(); // create “Observable”
mv = new MapView(); // create an “Observer” for the map
sv = new ScoreView(gw); // create an “Observer” for the game state data
gw.addObserver(mv); // register the map Observer
gw.addObserver(sv); // register the score observer
// code here to create menus, create Command objects for each command,
// add commands to Command menu, create a control panel for the buttons,
// add buttons to the control panel, add commands to the buttons, and
// add control panel, MapView panel, and ScoreView panel to the frame
setVisible(true);
}
}