Java Learners Hub
A place for coders and developers to share, learn and grow together.
For string comparison, == operator or equals method which we should prefer? And why?
as far as I know, you should use equals method for string, which equals() compares the contents of the string, where as == will compare the objects, so == will only be true if they both are point to same objects