ZR
When working with string builder .equals() method apparently doesn't work. In order to make it work you first need to convert the string builder to string by using .toString() and then use .equals() . Eg: sb1.toString().equals(sb2.toString()); Everything else is just perfect and I felt like adding this piece of information. 😊
CommentArticleJan 25, 2022Why should we prefer using .equals() to == while comparing strings in Java?