Comment on Tutorial - equals( ) Versus == in Java By Mashoud



Comment Added by : Virudada

Comment Added at : 2012-05-05 06:27:22

Comment on Tutorial : equals( ) Versus == in Java By Mashoud
import java.util.*;

public class demo {
public static void main(String[] args) {
int q=1;
int r=2-1;
Integer t=new Integer(1);
System.out.println(q==t);
System.out.println(t.equals(r));
System.out.println(q==r);
}
}

Output -

true
true
true

Please give me the explanation.
Many thanks in advance!


View Tutorial



Related Tutorials

Java program to get location meta data from an image

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

Archived Comments

1. thanks for all thanks for your help good bye
View Tutorial          By: ARAS at 2010-05-14 06:50:47

2. thanx mitra...it helped alot.
View Tutorial          By: psuyog at 2014-10-10 12:16:26

3. Great explanations! I looked for other guides and
View Tutorial          By: A.Lepe at 2010-09-15 21:36:42

4. I need dumps for practice
View Tutorial          By: Sanket barge at 2011-06-17 10:05:16

5. thank you...
View Tutorial          By: Rojan at 2011-07-04 01:51:45

6. very good helped me a lot
View Tutorial          By: Swaran at 2009-12-30 09:51:36

7. It is very useful ....Thank U sooo much dear...
View Tutorial          By: Augustine Francis at 2014-06-24 16:55:21

8. clearly explained the pgm logic....
thnx...

View Tutorial          By: Akshaya at 2011-11-24 04:12:36

9. I have maked all you said and when I open jsp I am
View Tutorial          By: John at 2013-01-10 14:21:30

10. hi.I am new in j2me and really want to learn more
View Tutorial          By: Deepak kumar at 2010-11-15 03:04:15