how to compare 2 strin code example
Example 1: how to know if String is the same java
String1.equals(String2)
Example 2: in java how to compare two strings
class scratch{
public static void main(String[] args) {
String str1 = "Nyello";
String str2 = "Hello";
String str3 = "Hello";
System.out.println( str1.equals(str2) ); //prints false
System.out.println( str2.equals(str3) ); //prints true
}
}