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. Awesome information
View Tutorial          By: Pavan Somu @ Tech Tips at 2013-01-03 18:45:30

2. Nice explaination of constructor and destructor. B
View Tutorial          By: Anon at 2009-03-01 03:50:06

3. what about strings in J2ME ?
View Tutorial          By: Swapnil at 2012-07-20 09:19:15

4. what about the remaining explanation......do anyth
View Tutorial          By: raki at 2011-11-07 10:47:25

5. that's what I've been looking for!!!!!!!!!!!!!!!!!
View Tutorial          By: bibi at 2014-12-28 20:43:56

6. why r there these methods in Object class not in T
View Tutorial          By: santosh at 2011-11-16 06:58:06

7. Thank you. I found this very helpful.
View Tutorial          By: tavella at 2014-09-26 01:04:13

8. Gracias, it worked.
View Tutorial          By: Eduardo at 2009-09-09 12:16:30

9. I have download that 5 files .But how to run this
View Tutorial          By: Unnati at 2011-07-07 06:07:26

10. thank you very much...
Explained in a simpl

View Tutorial          By: vineela at 2013-02-18 10:29:08