Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
    Bookmark Topic Watch Topic
  • New Topic

PLEASE HELP

 
John Michaels
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello. I'm creating a game where people can set up an account. Their registration information includes but is not limited to a login and a password. The login and the password are used to sign in. I store the sign in information in a player object, and each player object is stored in an Array List called players. How do I prevent the player objects from being deleted when I compile the program. Am I doing this the right way? Should I be storing the players sign in information in a file? If so, I'm not sure how to do this. Please help. Thank you. My code:



 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi John,

In brief: objects last only as long as the program they're created by is running, unless you specifically do something to change that. Usually, that means having a way to store the objects in either a file or a database, and a way to load objects from the file or database.

So right now, your game is an application that people can run at the command line; it's not networked, and it's not set up to run indefinitely while various people log in and out. If you want it to stay like this -- i.e., someone runs the application, logs in, plays, logs out and the application quits -- then just saving the login data in a simple flat file would probably be fine.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Welcome to the ranch. Please do not duplicate thread. Continue in the original one. And next time, make some effort to choose a meaningful subject line.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic