Eight queens in Java in recursion
<p>This is my Java code for eight queens. I don't know why it place same results for eight times.
In this code, diagonal is not included.</p>

<pre><code>import java.util.*;

class eightTeight {
    Set&lt;Integer&gt; s = new HashSet&lt;Integer&gt;();

    public void print() {
        if (s.size() &lt; 8) {
            for (int i = 0; i &lt; 8; i++) {
                if (!s.contains(i)) {
                    s.add(i);
                    print();
                }
            }
        }
        System.out.println(s);
        return;
    }
}
</code></pre>

<p>It seems that once return runs, the s still keeps the data. Appreciated to any help.</p>
