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



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 I have Fixed - "NoSuchPortException"
View Tutorial          By: vijay at 2011-02-19 01:44:37

2. a big thanks!
View Tutorial          By: xamae at 2010-01-13 02:52:51

3. Excellent article
View Tutorial          By: JJ at 2011-03-21 13:42:35

4. how can we split 12+12 into three tokens like 12,+
View Tutorial          By: arjun at 2012-11-26 11:07:24

5. Hello,
I want to send an mulitple sms using

View Tutorial          By: Fionna at 2009-07-10 01:02:11

6. I Want To Know More About Windows Azure Advantages
View Tutorial          By: sathish at 2010-08-31 10:23:10

7. Hi ,Razvan

I changed code as in you

View Tutorial          By: sanil at 2011-01-01 11:05:53

8. If i jus wanna read the files in the phone , how s
View Tutorial          By: vt at 2010-01-28 02:50:26

9. THANX FOR THE INFO....
View Tutorial          By: Abhinaykumar at 2010-07-06 11:34:53

10. works like a charm, though i didn't understand why
View Tutorial          By: primus at 2010-05-19 04:46:18