Can't reset list after change : <p>I have 10 elements List with 1 true and 9 false.</p>

<p>I want change last element for true and set rest to false.
I dont know why my code no works, in debug mode I set all for false, but in console i see 2x true.</p>

<p>My code is probably wrong:</p>

<pre><code>public class Test {

    private static boolean a = true;
    private static boolean b;
    private static boolean c;
    private static boolean d;
    private static boolean e;

    private static boolean a2;
    private static boolean b2;
    private static boolean c2;
    private static boolean d2;
    private static boolean e2;

    private static List&lt;Boolean&gt; listOfBooleans = new LinkedList&lt;&gt;();

    public static void main(String[] args) {

        listOfBooleans.add(a);
        listOfBooleans.add(b);
        listOfBooleans.add(c);
        listOfBooleans.add(d);
        listOfBooleans.add(e);
        listOfBooleans.add(a2);
        listOfBooleans.add(b2);
        listOfBooleans.add(c2);
        listOfBooleans.add(d2);
        listOfBooleans.add(e2);

        for (Boolean listOfBoolean : listOfBooleans) {
            System.out.println(listOfBoolean);
        }

        System.out.println("\n");

        setOnlyOne(9);

        for (Boolean listOfBoolean : listOfBooleans) {
            System.out.println(listOfBoolean);
        }

    }

    private static void setOnlyOne(int index){
        for (Boolean listOfBoolean : listOfBooleans) {
            listOfBoolean = false;
        }
        listOfBooleans.set(index, true);
    }

}
</code></pre>

<p>What I should change here ?</p>
