In this article, we will see how to use equals method of String class in Java.
In Java, Strings, we can use equals method to check if two String object is equal.
Lets look to our code.
String x = "a";
String y = "b";
System.out.println(x.equals(y));
Lets see it in an example.
In above example, we created two String object. We used equals method to check if two string object is equal. Method returned true.