java compare strings equal code example
Example 1: how to compare strings java
if (aName.equals(anotherName))
{
System.out.println(aName + " equals " + anotherName);
}
else
{
System.out.println(aName + " does not equal " +anotherName );
}
Example 2: how to know if String is the same java
String1.equals(String2)