this is my code:
import java.util.Scanner;
public class prac {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
System.out.print("input : ");
String x = input.next();
System.out.println(x=="a");
}
}
I'm a beginner of Java,
The code above is that simply lets the user enter a string type variable, and then compare whether the x variable is equal to "A", my problem is when i input "a" to x variable , but the result of System.out.println(x=="a") is false ! why ? can someone explain ?