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. Reading the above comments and questions I have my
View Tutorial          By: running on toaster at 2013-04-23 02:20:43

2. Hi Blackpanther, the mode is either 0 or 1. If you
View Tutorial          By: Ramlak at 2008-04-01 02:24:14

3. Thanks.It is very helpful
View Tutorial          By: JENI at 2013-03-23 11:01:58

4. Yesterday afternoon, I tried a lot of different su
View Tutorial          By: Leo at 2011-07-26 04:19:15

5. why treeSet always disply ascending order?
View Tutorial          By: swati at 2013-07-18 04:57:37

6. Sat Apr 23 10:44:14 IST 2011:Sender:*** time out a
View Tutorial          By: sasivarnan at 2011-04-23 01:17:18

7. How do you remove an element from the map?
View Tutorial          By: Shreejit at 2012-01-29 16:53:27

8. Good Example esp. way it was presented.
View Tutorial          By: Arunlal at 2013-06-20 11:56:43

9. I think u've done well, just that more examples wi
View Tutorial          By: Mac at 2011-01-23 10:22:10

10. i have to write a calculator program for very ve
View Tutorial          By: maryam at 2012-12-31 10:21:55