Decisions in Java – Comparing StringsComparing StringsTherelational operatorsused with the primitive data types (i.e., less than, greater than, equal to, etc.)should not be used to compare strings.Recall that aStringvariable does not actually contain thestring, but only the location (address) of the string object in memory.Thus any comparison betweenstrings using relational operators would actually be comparing two addresses, rather than theStringvalues.Java provides a number ofmethodsfor comparing strings, but for now we will introduce only theequalsand thecompareTomethods.These areString methods, which means it can be called fromanyString variable.Theequalsmethod – testing for identical stringsTheequalsmethod tests whether or not two strings areidentical, returning true if they are identical,and false otherwise.Example 1 – given the declarationString s = "Same";then theequalsmethod would yield the following results:a)s.equals("Same")will return trueb)s.equals("same")will return false because 'S' is not equal to 's'c)s.equals("Same")will return false because of the spaces at the end of the word