Comment on Tutorial - equals( ) Versus == in Java By Mashoud



Comment Added by : sraban

Comment Added at : 2011-10-13 12:13:38

Comment on Tutorial : equals( ) Versus == in Java By Mashoud
Hi,it's really nice to see all the comments of the given topic equals() method and '==' .i would like to share the solution of question asked by Vijay.lets see

result for s1==s2 and s1.equals(s2) for following cases?
1)String s1="hello";
String s2="hello";

->Both equals() and "==" give TRUE

2)String s1 = new String("Hello");
String s2 = new String("Hello");

equals() will give TRUE but "==" will give FALSE

3)String s1="hello";
string s2=s1;

In this case also both will give TRUE bez both pointing to same location

Hope this will help u


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. Can please send me codes to pass strings or text f
View Tutorial          By: bryan at 2009-12-29 05:59:21

2. It's helpful to me.. to understand stand clear pic
View Tutorial          By: Ansari at 2010-08-18 10:22:54

3. Thanks sir i am understand to jdbc but who will ru
View Tutorial          By: Ranjeet singh at 2012-05-04 07:40:29

4. Hi Mirna,
U r talking abt speech to text co

View Tutorial          By: akshat at 2012-04-02 14:38:31

5. you have helped me so much! thanks a lot ya! i rea
View Tutorial          By: NATION WHITE CHIRARA at 2013-09-19 07:53:57

6. How can I use stack in entering a letter and will
View Tutorial          By: mards at 2014-10-17 12:18:34

7. the neccessary code to create website using java
View Tutorial          By: haymanot girma at 2007-11-09 05:43:32

8. Hi.....u have put an extra backslash in the last f
View Tutorial          By: Samantha at 2011-05-12 12:54:39

9. we can create reference variable for an abstract c
View Tutorial          By: siva at 2012-08-30 06:03:50

10. I am java developer and interested to write scjp e
View Tutorial          By: Parvathi at 2013-07-05 14:24:08