0 / 60 seg.

What is the correct way to compare two strings for equality in Java?

String a = "text";
String b = "text";
if (a.equals(b)) {
    System.out.println("Equal");
} else {
    System.out.println("Not Equal");
}