title: How can I print out a array of objects
body: <p>So I am making a game and have a class Players each player has a <code>name</code> and <code>score</code>.</p>
  
  <p>I am trying to get user input for the names of each Player object  by calling a function and using for loops and setting the players name from user input from the user.</p>
  
  <p>I have tried a few things while researching still I have a problem.</p>
  
  <p>I saw some people say that <code>Array.toString(arr)</code> is how you print an array of objects.</p>
  
  <p>I am now getting an error </p>
  
  <pre><code>.\Player.java:13: error: incompatible types: unexpected return value
                  return "Player: " + name + "      Score"  + score;
  </code></pre>
  
  <pre><code>import java.util.*;
  class diceGame{
      // calling main method
      public static void main (String[] args){
          createPlayersArray(); 
  
      }
  
      //Get the details oto launch game such as the number of players
      //and collects their names to store in a array
      public static void createPlayersArray () {
          Scanner kb = new Scanner(System.in);
  
  
          System.out.println("Please enter the number of players: ");
          int numOfPlayers = kb.nextInt();
          //Player array to hold all the players
          Player [] playerArray = new Player[numOfPlayers];
  
  
          //Array to set the players names
          for (int i = 0; i &lt; numOfPlayers; i ++ ) {
  
              System.out.println("Please enter your name: ");
              String currentPlayerName = kb.next();
              playerArray[i] = new Player(currentPlayerName, 0);
  
           }
  
           System.out.println("This should be the list of players");
           for (int i = 0; i &lt; playerArray.length; i ++ ) { 
                  System.out.println(Array.toString(playerArray));
           }
  
      };
  }
  
  /////////////////////// Player Class//////////////////////////
  
  class Player{
      public String name;
      public int score;
  
  
  
      public Player (String n, int s){
          name = n;
          score = s;
      }
  
      public void nameAndScore (){
          return "Player: " + name + "      Score"  + score;
      }
  
  
      //Geters and Setter name 
      public String getName(){
          return name;
      };
  
      public void setName(){
          return name;
      }
  };
  </code></pre>
  
  <p>It not so much a error but I am getting the memory address displayed:</p>
  
  <pre><code>Player@880ec60
  Player@3f3afe78
  Player@7f63425a
  Player@36d64342
  </code></pre>
  
  <p>I would like the console to print:</p>
  
  <pre><code>Tom   score: 0
  Jerry score: 0
  </code></pre>