Comment on Tutorial - equals( ) Versus == in Java By Mashoud
Comment Added by : Gunjan
Comment Added at : 2010-09-08 19:24:24
Comment on Tutorial : equals( ) Versus == in Java By Mashoud
Hello Friends ,
s1 == s2 will always give false . Because s1 == s2 gives refers to the different memory location .
Note that , in java every object refers to the different memory locations. So , == will always give you false.
If we declare s1=s2 then it will give true . While s1.equals(s2) compares the character within the String object . So it will give true.
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
Subscribe to Tutorials
1. Hi all, i have tried above code, but am getting fo
View Tutorial By: shalini Iyer at 2008-04-22 01:20:32
2. Sir , I am doing B.Tech . I want to know more abou
View Tutorial By: amita saini at 2011-08-05 13:07:35
8. Thank you! This article helped me to solve this pr
View Tutorial By: Stan Devyatovsky at 2008-09-12 05:20:20