Eclipse - Slot machine, if and else if increasing an int incorrectly
<p>I am creating a slot machine with swing. The follow code has to check and assign results:</p>

<pre><code>// Reset win amount
    winAmount = 0;

    // Checks for winning combinations and increases corresponding values
    if (num[0]==num[1] &amp;&amp; num[1]==num[2]){
        winAmount = 4;
        coinsWon = coinsWon + winAmount;
        txtWinMessage.setText("Jackpot! You have won " + winAmount + " !"); 
        txtCoinsWon.setText(coinsWon + " ");

        // A text field for testing - so i can see the math it does
        textField_6.setText(coinsWon + " " + winAmount + " / 0 = 1");
    } else if (num[0]==num[1] || num[0]==num[2] || num[1]==num[2]){
        winAmount = 1;
        coinsWon = coinsWon + winAmount;
        txtWinMessage.setText("You Have Won " + winAmount);
        txtCoinsWon.setText(coinsWon + " ");

        // A text field for testing - so i can see the math it does
        textField_6.setText(coinsWon + " " + winAmount + " / 0 = 1");
    } else {
        txtWinMessage.setText("Sorry, try again");

        // A text field for testing - so i can see the math it does
        textField_6.setText("Went to else. coinsWon = " + coinsWon);
    }
</code></pre>

<p>The num[0], num[1] and num[2] are generated via this bit:</p>

<pre><code>private void setIcon(int i) {
    num[i] = random.nextInt(8);
    slots[i].setIcon(new ImageIcon(getClass().getResource("images/slotIcon" + num[i] + ".png")));
    counter++;
    if(counter &gt; 50) {
        winAmount = 0;
        getResults();
    }
}
</code></pre>

<p>The testing fields I have show me that the num[i] gets assigned correctly and the ImageIcons are set correctly according to num[i] too. Though problems occur when it comes to the result math. If it goes to the IF part it adds +4 to coinsWon, if to goes to the ELSE IF it adds +1 to coinsWon, though if it goes to ELSE sometimes it doesn't add anything as it should, but sometimes it adds +1 to coinsWon or even +2. But not because winAmount would be 1, but because coinsWon just changes to a bigger number without any apparent reason.. </p>

<p>Any ideas?</p>
