Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7517151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:21:20+00:00 2026-05-30T01:21:20+00:00

I have a school project I’m not supposed to be starting til monday, and

  • 0

I have a school project I’m not supposed to be starting til monday, and it’s not due for another 6 weeks or longer. We are creating a program in java to add what we want to a database, I chose games (title, genre, platform, price, quantity(string, combobox, combobox, double, int)), I’m using a stack to add all of the objects to, but for some reason I can’t get it to compile for some reason, and I keep getting really strange errors. My error and then code are below respectively.

nathan@ubuntu:~/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);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:21:22+00:00Added an answer on May 30, 2026 at 1:21 am

    This call:

    gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
    

    should be in some method, since you want to do it i every new object, as it looks from your code, why not moving it to the constructor:

    public class GameCombo extends JPanel {
      ArrayList<Game> gamesList = new ArrayList<Game>();
      Stack<Game> gamesStack = new Stack<Game>();
      private JComboBox _gameBox;
    
        public GameCombo() {
             setLayout(new GridLayout(1,1,1,1));
             gamesStack.push(new Game("[Halo: Reach]", 3, 1, 108.00, 2));
             _gameBox = new JComboBox(gamesStack);
             add(_gameBox);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a school project to program multilayer perceptron that classify data into three
I'm creating a registration form on my school project website. I have given a
I have an interest in creating a NoSQL database system for a school project
I have a school project in which I am creating a Non Relational Document
For a school project, I have a simple program, which compares 20x20 photos. I
Working on a school project, the program is supposed to read from a text
I hope, this question is not too offtopic. I have a bigger school project
I have a school project in which I have to implement a chat application,
I have a school project in which we're going to write a financial engine
I have some troubles with my school project. I have a class: #include Group.h

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.