Inner class cannot construct new instance of other inner class
<p>I have a class called <code>Scraper</code> with a static inner class <code>Builder</code>, and also a non-static inner class called <code>StringPair</code>, I'm trying to get one of the builder methods to construct a <code>new StringPair(a,b)</code> and add it to an <code>ArrayList&lt;StringPair&gt;</code>, however it doesn't compile, the compiler says <code>Error: non-static variable this cannot be referenced from a static context</code> and specifically highlights the <code>new StringPair(a,b)</code> as the source of the problem.</p>

<p>I don't understand what's wrong here, any help would be appreciated!</p>

<pre><code>class Scraper {

    private final ArrayList&lt;StringPair&gt; stringPairs;

    Scraper(Builder builder) {

        stringPairs = builder.builderStringPairs;


    }

    public static class Builder {

        private static ArrayList&lt;StringPair&gt; builderStringPairs = new ArrayList&lt;StringPair&gt;();

        public Builder addStringPairs(String a, String b) {

            builderStringPairs.add(new StringPair(a, b));
            return this;
        }

        public Scraper build() {
            return new Scraper(this);
        }

    }

    class StringPair {
        String a,b;

        StringPair(String a, String b) {
            this.a = a;
            this.b = b;

        }



        String getA() {
            return a;
        }
        String getB() {
            return b;
        }


    }

}
</code></pre>
