我有一個學校項目,我不應該開始直到星期一,而且這不是由於另外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