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



Ask a Question

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. Question: if clone is a protected method then why
View Tutorial          By: siva kiran at 2011-01-20 11:40:23

2. Thanks for this tip -
I'm currently workin

View Tutorial          By: Helen at 2009-06-16 05:28:24

3. can anybode tell me how can i make my own bluetoot
View Tutorial          By: Prasenjit at 2013-10-11 06:57:13

4. It has been really helpful for me to gather inform
View Tutorial          By: sonam at 2009-03-08 09:41:33

5. In line No. 23, change stmd to stmt.
Re

View Tutorial          By: Rishi Raj at 2011-07-08 13:50:11

6. very nice and good introduction for beginners.
View Tutorial          By: annie at 2011-11-23 06:50:32

7. good and nice
View Tutorial          By: Elayaraja j at 2011-06-18 05:30:07

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

9. sir i want to knw abt all simple java programs pls
View Tutorial          By: sakthi at 2011-08-29 14:06:10

10. In the 2nd example ,during the creation on object
View Tutorial          By: priyanka thakur at 2011-08-29 20:24:16