title: How to fix the error of making a static reference to a non-static method using array lists
body: <p>at the moment I am just doing some practise in java:</p>
  
  <p>Main:</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Random;
  import javax.swing.JOptionPane;
  import settelersofcatan.playerinformation;
  
  public class settlersofcatanhelper 
  {
       private ArrayList&lt;playerinformation&gt; PlayerArray = new ArrayList&lt;playerinformation&gt;();
       public static void main(String[] args) 
       {
           String NumberOfPlayersString = JOptionPane.showInputDialog("How many player");
           int NumberOfPlayers = Integer.parseInt(NumberOfPlayersString);
  
  
           for (int Counter = 0; Counter &lt; NumberOfPlayers; Counter++)
           {
               String Name = JOptionPane.showInputDialog("Name of player " + Counter);
               String Colour = JOptionPane.showInputDialog("which colour are you playing with");
               playerinformation PlayerDetails = new playerinformation(Name, Colour, Counter);
               addplayer(PlayerDetails);
           }
  
       }
  
      public void addplayer(playerinformation player)
      {
      this.PlayerArray.add(player);
      }
  }
  </code></pre>
  
  <p>Helper Class:</p>
  
  <pre><code>package settelersofcatan;
  
  public class playerinformation {
      String PlayerName;
      String Colour;
      int Position;
  
      public playerinformation(String name, String colour, int position) 
      {
          setPlayerName(name);
          setColour(colour);
          setPosition(position);
  
      }
  
      public String getPlayerName() {
          return PlayerName;
      }
      public void setPlayerName(String playerName) {
          PlayerName = playerName;
      }
      public String getColour() {
          return Colour;
      }
      public void setColour(String colour) {
          Colour = colour;
      }
      public int getPosition() {
          return Position;
      }
      public void setPosition(int position) {
          Position = position;
      }
  }
  </code></pre>
  
  <p>The Problem that I am having now is that I am trying to add a player's information and get the response "Cannot make a static reference to the non-static method addplayer(playerinformation) from the type settlersofcatanhelper".
  I have looked over the code where I have this working but cant see any difference or reason why it wouldnt work. Can anyone help me?</p>