How do I get the correct response to print out?

import java.util.*;
import java.io.*;


public class MultipleChoiceTest {
	public static void main (String[] args) {
	Scanner input = new Scanner( System.in );
	
	String Question;
	String FirstName;
	String LastName;
	String Answer;
	
	double CorrectTotal;
	double IncorrectTotal;
	double TotalQuestions;
	double OverallTotal;
	
	
		System.out.println("Please Enter First Name: ");
		FirstName = input.next();
		System.out.println("First Name: " + FirstName);
		
		System.out.println("What code set is used for Inpatient Hospital Procedures? \nA). ICD-9-CM Vol. 3  \nB). HCPCS \nC). ICD-13 ");
		System.out.println("Please Enter You Selection:"); 
		Answer = input.next();
		System.out.printf("Your Answer is: " + Answer );
		
		if (Answer == "A")
			{System.out.println("You Are Correct!");}
		else 
			{System.out.println("You Are Incorrect");}
		
	}

}

A Is the Right Answer, but it's not coming out like that:

Please Enter First Name: 
asdf
First Name: asdf
What code set is used for Inpatient Hospital Procedures? 
A). ICD-9-CM Vol. 3  
B). HCPCS 
C). ICD-13 
Please Enter You Selection:
A
Your Answer is: AYou Are Incorrect

Edited 5 Years Ago by PDB1982: n/a

Your Answer is: AYou Are Incorrect

Is this the line you want to change?
What do you want it to be changed to?

if (Answer == "A")

Use the equals() method when comparing the contents of Strings. The == operator is for primitives.

Edited 5 Years Ago by NormR1: n/a

This article has been dead for over six months. Start a new discussion instead.