I have to make the "Who wants to be a millionaire" game. The game has to work with file (writing/ creating a user file with all the info). The questions are picked randomly from a txt file and saved in "intrebareSIraspuns[6][15]"(6 -> 1 question, 4 answers, 1 correct answer; 15 -> questions). The questions are named "questionNr" and it's incremented after each correct answer. My problem is when the user has to give the correct answer for the question. The user has to type in the console the the corresponding letter of the answer (A, B, C, D), but when the correct answer is typed the result is always wrong. I will put the code for the correct question verification, which I've made it a little more longer just to check where is the problem, and the output of the console.
Here's code:
    /*                      *
     *                      *
     *     ANSWER CHECK     *
     *                      *
     *                      *
     */
public int check()
{
    Scanner input=new Scanner(System.in);
    int ret=0;
    System.out.println("Type your answer: ");
    userAnswer=input.next();
    if(intrebareSIraspuns[5][questionNr].equals(intrebareSIraspuns[1][questionNr]))
    {
        ret=1;
    }
    if(intrebareSIraspuns[5][questionNr].equals(intrebareSIraspuns[2][questionNr]))
    {
        ret=2;
    }
    if(intrebareSIraspuns[5][questionNr].equals(intrebareSIraspuns[3][questionNr]))
    {
        ret=3;
    }
    if(intrebareSIraspuns[5][questionNr].equals(intrebareSIraspuns[4][questionNr]))
    {
        ret=4;
    }
    System.out.println("Return = " + ret);
    System.out.println("User Answer =" + userAnswer + ".");
    if((userAnswer=="A") && (ret==1))
    {
        answerVar=1;
        System.out.println("The corect answer is: A. " + intrebareSIraspuns[1][questionNr]);
    }
    else
        if((userAnswer=="B") && (ret==2))
        {
            answerVar=2;
            System.out.println("The corect answer is: B. " + intrebareSIraspuns[2][questionNr]);
        }
        else
            if((userAnswer=="C") && (ret==3))
            {
                answerVar=3;
                System.out.println("The corect answer is: C. " + intrebareSIraspuns[3][questionNr]);
            }
            else
                if((userAnswer=="D") && (ret==4))
                {
                    answerVar=4;
                    System.out.println("The corect answer is: D. " + intrebareSIraspuns[4][questionNr]);
                }
                else
                {
                    answerVar=5;
                    System.out.println("Your answer is wrong!");
                    if(ret==1)
                    {
                        answerVar=6;
                        System.out.print(" The corect answer was: A. " + intrebareSIraspuns[1][questionNr] + "\n");
                    }
                    else
                        if(ret==2)
                        {
                            answerVar=7;
                            System.out.print(" The corect answer was: B. " + intrebareSIraspuns[2][questionNr] + "\n");
                        }
                        else
                            if(ret==3)
                            {
                                answerVar=8;
                                System.out.print(" The corect answer was: C. " + intrebareSIraspuns[3][questionNr] + "\n");
                            }
                            else
                                if(ret==4)
                                {
                                    answerVar=9;
                                    System.out.print(" The corect answer was: D. " + intrebareSIraspuns[4][questionNr] + "\n");
                                }
                }
    input.close();
    return answerVar;
}
And the console output is:
0081 Whose return to 'EastEnders' in 2004 sparked a 560 megawatt power surge on the national grid?
    A. Filthy Fred
    B. Smutty Sam
    C. Grubby Gordon
    D. Dirty Den
ANSWER. Dirty Den
Type your answer: 
D
Return = 4
User Answer =D.
Your answer is wrong!
 The corect answer was: D. Dirty Den
 
     
     
     
    