Hi Chitra,
If u put " string " with spaces at both ends or a space at either end, the method will create a new string. But if u put like this "string" with no spaces in the end, it will return the same string, which is already in the string pool. That is why it prints "equals". If u have any doubt in string methods, it is better to have a look at the source code.