The == operator works fine for int, double, and other primitive types. But for String, it checks whether two variables point to the same object in memory, not whether they contain the same text.
String a = new String("hello");
String b = new String("hello");
System.out.println(a == b); // false!
System.out.println(a.equals(b)); // true
Both variables hold "hello", but == returns false because a and b are different objects. The .equals() method compares the actual characters inside the strings, which is what you want % of the time.
Always use .equals() for string comparison. If you use ==, your code will sometimes work (due to Java's string pool) and sometimes fail, creating bugs that are hard to track down.