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. Hi All,
I can send sms successfully from Wi

View Tutorial          By: henrynawaung at 2008-11-14 06:41:13

2. good
View Tutorial          By: dock at 2013-06-07 15:18:49

3. Everything is running.... But it doesn't send....
View Tutorial          By: Amirtharaj at 2009-04-14 05:26:26

4. you have extended class Abc within class Abc

View Tutorial          By: SUNIL SHAH at 2012-05-25 06:17:23

5. Hii... pls how can I create a aerver with an inter
View Tutorial          By: WAZIRI at 2010-03-16 11:12:11

6. Hello,
I would like to know how will take p

View Tutorial          By: Jeff at 2011-02-02 23:05:17

7. Hi I too need the full program for understanding
View Tutorial          By: Sumanth at 2010-10-03 16:02:46

8. this is simple and informative.thanks
View Tutorial          By: amrita at 2011-11-12 14:32:58

9. Thanks for the Information. Its very useful
View Tutorial          By: Husain at 2009-03-04 13:30:38

10. hi please help me out.. how to use this card for r
View Tutorial          By: sasivarnan at 2011-04-27 15:01:12