title: How to save object variables after closing my program?
body: <p>I'm trying to learn Java and OOP by creating a monopoly banker program. However, I would like some object variables to be saved after I exit the program, so that after playing half of a monopoly game I can exit my program and then restart it with all the player balances saved.</p>
  
  <p>I'm guessing this requires some sort of database?</p>
  
  <p>Here is a section of my code; I am trying to save the "balance" variable for all of my objects (players) after I exit my program.</p>
  
  <pre><code>   public class Monopoly {
  
  /**
   * @param args the command line arguments
   */
  public static void main(String[] args) {
      // TODO code application logic here
      //creates the users (name classes)
  players player1 = new players();
  players player2 = new players();
  players player3 = new players();
  players player4 = new players();
  
  
  
  while (true)  {
  
  player1.balance=player1.finalbalance;
  player2.balance=player2.finalbalance;
  player3.balance=player3.finalbalance;
  player4.balance=player4.finalbalance;
  </code></pre>