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.


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. good job
by- shiv at 2010-11-26 11:51

View Tutorial          By: shiv kumar bind at 2010-11-25 23:20:28

2. why we use int with main
View Tutorial          By: praveen at 2012-03-26 04:28:20

3. iam getting intrest to watch this site
View Tutorial          By: monika at 2013-02-15 15:48:57

4. hi good article with explanation
View Tutorial          By: yuganthi at 2012-09-24 05:18:35

5. Thanks for the insight. Easily understood.
View Tutorial          By: Bobby Deol at 2014-01-17 00:48:44

6. i want to know how to connect to a remote mysql da
View Tutorial          By: lixiang at 2013-04-23 04:32:58

7. wonderful
simplified description
ke

View Tutorial          By: ephrem at 2010-01-14 06:12:05

8. Hi, a have a problem using bsearch. i need return
View Tutorial          By: Daniel at 2009-03-30 04:11:13

9. Friends i m getting error while intrepreting the e
View Tutorial          By: Hanuman at 2014-02-04 14:14:00

10. Really clear and lucid explanation abt realloc ...
View Tutorial          By: metarus208 at 2012-01-01 14:25:25