title: How do I access an array list inside of a class constructor in java?
body: <p>I constructed a <code>Purse</code> class with the following:</p>
  
  <pre><code>public Purse(){
      ArrayList&lt;String&gt; coins = new ArrayList();
  }
  </code></pre>
  
  <p>My function to add strings to the object:</p>
  
  <pre><code>public void addCoin(String coinName){
      coins.add(coinName);
  }
  </code></pre>
  
  <p>This idea is that each Purse object can hold a list of strings. I cannot, however, access the <code>ArrayList&lt;String&gt; coins</code> with my methods.</p>
  
  <p>For example, this method I wrote to reverse the order of the strings</p>
  
  <pre><code>public void reverse(){
      for (int j = coins.size() - 2; j &gt; -1; j--){
          coins.add(coins.get(j));
          coins.remove(j);
  }
  </code></pre>
  
  <p>calls the error that the symbol <code>coins</code> cannot be found.</p>
  
  <p>How do I make it so that my methods can access the array list I made inside of my constructor? Do I need to say something along the lines of <code>this.coins.add(coinName)</code> for the <code>void addCoin</code> method or <code>this.coins.add(this.coins.get(j))</code> for the reverse method?</p>