tag:blogger.com,1999:blog-694855878384792308.post6170503409690301277..comments2024-03-21T06:26:49.387-07:00Comments on Java67: Difference between == and equals() method in Java? String Examplejavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-694855878384792308.post-19786081649002000612020-01-06T17:18:42.804-08:002020-01-06T17:18:42.804-08:00I agree. I agree. javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-30360376331190775672020-01-06T08:02:14.495-08:002020-01-06T08:02:14.495-08:00Piling on, == will work with Strings due to a quir...Piling on, == will work with Strings due to a quirk with how they are allocated in memory. You should not depend on this behavior though.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-77266442281329473442017-11-07T04:51:14.557-08:002017-11-07T04:51:14.557-08:00You have mentioned in the article that s1 == s2 re...You have mentioned in the article that s1 == s2 returns false but it returns true for me.<br />I am using eclipse just in case this information helps in reasoning out.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-65501256853648265922015-10-07T05:32:07.808-07:002015-10-07T05:32:07.808-07:00@Anonymous, I didn't say they are equal. Of-co...@Anonymous, I didn't say they are equal. Of-course if you compare them using == the result will be false. javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-16852776128881517682015-10-06T21:25:01.497-07:002015-10-06T21:25:01.497-07:00As per your article "diff b/w string literal ...As per your article "diff b/w string literal and string object", you sed that when you use new operator it creates a separate new object, so then in the above first snipets, how come the object of String are equal w.r.t reference , <br /><br />Reply back.. thanks for answering... Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-26431619969264744862015-02-21T11:23:25.473-08:002015-02-21T11:23:25.473-08:00== operator returns true or false why == operator returns true or false why Anonymoushttps://www.blogger.com/profile/11500266521801270080noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-175702088362135222013-01-07T00:49:11.324-08:002013-01-07T00:49:11.324-08:00I think most important difference between equals a...I think most important <a href="http://javarevisited.blogspot.com.br/2012/12/difference-between-equals-method-and-equality-operator-java.html" rel="nofollow">difference between equals and == operator in Java</a> is that former is method while other is operator, isn't it ?Anonymousnoreply@blogger.com