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. Been looking at several website for a clear explan
View Tutorial          By: Jase at 2011-08-09 12:00:10

2. fantastic explaination about XML parsers
View Tutorial          By: smitha at 2011-05-15 04:53:00

3. This will give the output check it out


View Tutorial          By: shruthi at 2013-01-18 06:00:08

4. Its working ,,, gud stuff.
View Tutorial          By: Atul at 2011-07-21 10:34:44

5. hi!
please tell how i got the java comm api

View Tutorial          By: suresh at 2010-08-22 03:29:06

6. nice example and this is very use ful
View Tutorial          By: jyothi at 2011-02-18 22:24:51

7. Hi , instead of using localhost. I am using a mobi
View Tutorial          By: vimal at 2010-12-02 01:44:40

8. My Friend,

Thank you so much for ex

View Tutorial          By: Bikash at 2010-05-30 00:15:26

9. Thanks for the tutorial.

One questi

View Tutorial          By: Stephen at 2012-06-09 06:36:23

10. This article is not correct. Two-way synchronizat
View Tutorial          By: Travis at 2015-07-14 12:28:32