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. Except for when you're programming low level hardw
View Tutorial          By: Jonathan H at 2012-05-10 08:46:48

2. how this program is work , please, tell
View Tutorial          By: rohit kumar at 2015-10-30 12:22:05

3. very informative
View Tutorial          By: santhosh reddy WILLY at 2012-07-06 21:33:39

4. Hi,
Its good but you can make it more bette

View Tutorial          By: vishakha sharma at 2010-12-15 06:14:52

5. this article is excellent....solve all my doubt re
View Tutorial          By: pramodk at 2011-07-18 14:22:18

6. i have downloaded the code and calling the the SMS
View Tutorial          By: sandeep das at 2009-04-09 11:12:16

7. Thanks...

Rohit
xpode.com

View Tutorial          By: Rohit at 2012-04-30 04:18:12

8. i have connected my phone through bluetooth using
View Tutorial          By: nikitha at 2013-02-06 05:05:04

9. if a class is declared as abstract and it contains
View Tutorial          By: nagaraj at 2012-04-25 17:12:30

10. your second last example in above code (Character
View Tutorial          By: jyoti at 2011-11-06 17:01:19