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 8014847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:04:18+00:00 2026-06-04T20:04:18+00:00

For my school project I am creating a game like Bad Apples for iPhone

  • 0

For my school project I am creating a game like Bad Apples for iPhone (not my personal choice but it isn’t the problem).

The game needs to have two versions, the first one in console and the second one in JavaFX. But I wanted to go a little further with that. I want to add arguments that the user can add to the terminal when launching the game, for example

java -jar BadApplesClone.jar –height=10 –width=10 –numPieces=5

And then I will handle all the values introduced and change the variables.

I am using OpenJDK6, and so I am doing like this for now :

    for (int i=0; i<args.length; i++)
    {
        if (args[i].equals("--help"))
            throw new UnsupportedOperationException("Not yet implemented");

        if (args[i].equals("--largura"))
            throw new UnsupportedOperationException("Not yet implemented");

        if (args[i].equals("--altura"))
            throw new UnsupportedOperationException("Not yet implemented");

        if (args[i].equals("--pecas_inicio"))
            throw new UnsupportedOperationException("Not yet implemented");

        if (args[i].equals("--javafx"))
        {
            JavaFX javaFX = new JavaFX(ALTURA, LARGURA, PECAS_INICIO);
            javaFX.initJogo();
        }
    }

But I don’t know how to handle the values like –width=10.. I have thought of an enum, but I don’t really know how to do that.

Can anyone explain me a way to achieve this?

  • 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-06-04T20:04:21+00:00Added an answer on June 4, 2026 at 8:04 pm

    To answer the question you actually asked …

    Some of the elements of your args array are of the form “–SOMETHING=ANOTHER”.

    So, first thing you need is:

    if(args[x].startsWith("--SOMETHING")) { 
    

    The second problem is to parse off the ANOTHER.

    args[x].split("=") 
    

    is the place to start with that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a game for my school project, so I am not here
For a school project we're developing a game that's a little like Conway's game
I'm doing a school project about maintaining a personal Database. but my tutors didn't
I am creating a simple Mahjong game for a final project at school and
I'm working on creating an ASCII interface for a school project but I've run
As a school project I am creating a browser game in Java, for the
I'm creating a backbone for a school project, but I'm running into unresolved external
For my school project, I would like to build a gui that someone else
while working on a school project i ran into a problem using javascript to
I'm creating an RPN calculator for a school project and having trouble with the

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.