我有一个学校项目,我不应该开始直到星期一,而且这不是由于另外6周或更长的时间。我们正在用java创建一个程序来添加我们想要的数据库,我选择了游戏(标题,流派,平台,价格,数量(字符串,组合框,组合框,double,int)),我使用堆栈来添加所有的对象,但由于某种原因,我不能让它编译出于某种原因,我不断得到非常奇怪的错误。我的错误和代码分别在下面。意外的错误
[email protected]:~/Desktop/TAFE/Jeff (Java)/personalProject$ javac *.java
GameCombo.java:11: <identifier> expected
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: illegal start of type
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: ')' expected
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: ';' expected
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: illegal start of type
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: <identifier> expected
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: ';' expected
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: illegal start of type
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: <identifier> expected
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: <identifier> expected
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: illegal start of type
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: <identifier> expected
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: ';' expected
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: illegal start of type
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: <identifier> expected
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
GameCombo.java:11: ';' expected
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
^
16 errors
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
public class GameCombo extends JPanel {
ArrayList<Game> gamesList = new ArrayList<Game>();
Stack<Game> gamesStack = new Stack<Game>();
gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
//gamesList.add(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
//gamesList.add(new Game("[Dead Space]", "Xbox 360", "Horror", "$68.00", "1"));
//String[] games = {"", "[Halo: Reach] Xbox 360; Action; $108.00; 2;", "[Dead Space] Xbox 360; Horror; $65.00; 1;"};
private JComboBox _gameBox = new JComboBox(gamesStack);
public GameCombo() {
setLayout(new GridLayout(1,1,1,1));
add(_gameBox);
}
}
添加了作业标签。 – 2012-02-16 07:38:45
它在那里,但有些人删除它。 – 2012-02-16 08:06:54