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



Comment Added by : ku

Comment Added at : 2009-05-11 10:17:51

Comment on Tutorial : equals( ) Versus == in Java By Mashoud
When JVM find two string object with de same content, in order to save memory, insted of create two objects, this two objects stay referenced to the same memory location.
I mean, if you have a string "Hello" already created, when you create a new string with the same word "Hello" JVM detect that already exist this string and then did not create a new object, JVM just make a reference the two objects to the same "Hello", so S1 and S2 are "pointing" to the same place in the memory, and S1 == S2 are 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. to get more and clear information about java progr
View Tutorial          By: SWARNA at 2010-09-13 04:23:10

2. realy very nice artical it give good understable
View Tutorial          By: vivek at 2009-06-19 01:27:46

3. thank you
i memorized it easly .

View Tutorial          By: kibrom at 2011-04-27 11:46:24

4. could you send me a code for a music video mobile
View Tutorial          By: Christian at 2009-08-28 23:03:45

5. What is this....for simple question every one was
View Tutorial          By: Kaify at 2011-07-27 21:35:52

6. too good post....very easy to understand
View Tutorial          By: Rahul at 2013-03-04 17:09:58

7. Hi Kartikeyan and all,

can you plea

View Tutorial          By: Piyush at 2008-11-14 07:24:16

8. Hi ,

Since both the methods in the

View Tutorial          By: Chintan at 2013-11-21 03:42:32

9. Thank you for good explanation. I am thinking of u
View Tutorial          By: Darshan at 2012-06-22 15:44:57

10. Very good basic example. Thanks a lot.............
View Tutorial          By: satish at 2010-04-15 05:39:41