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. hi Emiley J.,
i am geting this error while

View Tutorial          By: jugal at 2009-02-20 02:14:23

2. Hi,
tell me What is struts chaining with ex

View Tutorial          By: Mekala venkateswara at 2010-07-03 09:39:59

3. hi i m deepika mittal . i m working on the same pr
View Tutorial          By: deepika Mittal at 2009-05-30 06:55:22

4. really superb in simple english with examples. Exp
View Tutorial          By: hariharan at 2009-01-14 22:22:32

5. Good
View Tutorial          By: sandesh at 2009-10-01 01:15:29

6. Hi people,
for those getting the Time out

View Tutorial          By: Ramlak at 2008-05-08 08:28:29

7. Thanks to the author, it was really a good tutoria
View Tutorial          By: Ashok Kumar at 2010-04-29 05:54:47

8. How to write data from keyboard to a file in java?
View Tutorial          By: Ashish Ranjan at 2011-07-13 01:04:38

9. @ Qui:

You can set the CSS Style:
View Tutorial          By: hache at 2010-06-22 02:02:56

10. @Vipin : vipin u r wrong,,,in reality java does n
View Tutorial          By: Arpit Tyagi at 2010-07-23 04:11:20