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. Very good. but why i can search data then report v
View Tutorial          By: ARMAN AHMED at 2015-04-27 13:18:04

2. Can anybody send full code for sending and receivi
View Tutorial          By: Jayapal at 2010-08-12 11:41:38

3. How to execute all these 5 files plz tell me step
View Tutorial          By: Umesh Kamankar at 2011-03-19 10:56:29

4. thank you, this best for student like us,
View Tutorial          By: Srinath at 2012-05-12 15:04:03

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

6. how to compile and run the above program ? please
View Tutorial          By: samir at 2009-12-22 00:42:52

7. Very good for the example......
View Tutorial          By: Tuhin Subhra Mandal at 2012-10-14 12:22:01

8. This program not running on my system so give some
View Tutorial          By: Ajay Kumar Barik at 2009-06-15 02:28:47

9. Great tutorial. Thanks guys.
View Tutorial          By: John D at 2009-03-21 11:01:58

10. how i can used inheritence ?
View Tutorial          By: samee at 2008-02-16 12:54:27