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

  • Home
  • SEARCH
  • 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 9229297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:32:12+00:00 2026-06-18T05:32:12+00:00

Please see ifmy logic is correct i do not know how to implement what

  • 0

Please see ifmy logic is correct i do not know how to implement what i am trying to do. I am a beginner in java.

Game is a class which stores the Name and the Steps of that user after the game is complete.

[ First Method ]

private game[] gameArray = new game[10];

for(int i = 0; i <gameArray.length;i++){
         gameArray[i].setName(nameTxt.getText());
         gameArray[i].setpSteps(stepsCount);
    }

By Clicking History Button they will get the previous 10 people’s name and steps.

JOptionPane.showMessageDialog(null,
       "Player's Name No. of Steps"+
       "\n"+gameArray[i].toString());

-The Problem:

1) This code limits to only previous 10 results is there anyway i can get all the previous results

2) This code is not working!

[ Second Method – This is also not working! ]

private game[] gameArray = new game[10];

// Storing the name of player[i]

gameArray[i].setName(nameTxt.getName());

// Storing the number of steps player[i] took.

gameArray[i].setpSteps(stepsCount);

//Displaying previous 10 players name and steps

JOptionPane.showMessageDialog(null,
       "Player's Name No. of Steps"+
       "\n"+gameArray[i].toString());
  • 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-18T05:32:13+00:00Added an answer on June 18, 2026 at 5:32 am

    Some points:

    • you can’t directly convert an array to a String through toString() because it isn’t supported in Java, you should use Arrays.toString(..)
    • Java arrays have static size, if you want to store the whole history you will need a dynamic data structure as an ArrayList<Game> or a LinkedList<Game>
    • name of classes should be capitalized (Game, not game)
    • without knowing the internals of your Game class it’s impossible to tell what is not working and why it is not working, we don’t even know what it is supposed to do exactly
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a helper class DAO (I do not know if is OK have
Please see demo here: http://jsfiddle.net/mA6qm/1/ (expand console) Why aren't events being sent or received
Please see here , at the end of the post, the 70px author image
Please see below code: thrust::device_vector<int>::iterator whereToBegin = copyListOfNgramCounteachdoc.begin(); end = thrust::unique_by_key(end.first, end.first + numUniqueNgrams,end.second);
Please see this example: if (strlen($_SESSION['userDetails']['THISNAME']) == 0) { $_SESSION['userDetails'][''.$THISNAME.'Error'] = autofocus; include $docRoot/html/forms/reg/user_info.html.php;
Please see below: I tried using Absolute layout, but that's deprecated. I appreciate your
Please see the code snippet below : #include <iostream> using namespace std; int main()
Please see the following manifest. The Activity_1's primary objective has mapInfo refers to a
(Please see update at bottom) I've looked at dozens of questions and haven't been
Please see this IBM site - http://www.ibm.com/us/en/ If you see the site banners, there

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.