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



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. This tutorial is really Good and enhance my desire
View Tutorial          By: Yasin at 2011-07-09 10:04:57

2. thanks i learnt how to use isset in php
View Tutorial          By: free web directory at 2010-09-15 19:42:28

3. I need the multiple record store RMS code.Pls help
View Tutorial          By: Raghuvir at 2009-05-13 23:03:44

4. hi ,
i tried the code given, the connect

View Tutorial          By: barani at 2010-05-27 05:32:11

5. this is the one of the best site to search java pr
View Tutorial          By: gautam gorai at 2009-01-13 06:44:15

6. i din understand
View Tutorial          By: panda at 2011-07-14 09:35:36

7. how can get ip url...?
View Tutorial          By: arjuna at 2011-11-23 03:31:46

8. Thank you very much for this tip.
View Tutorial          By: Lise at 2011-07-15 13:27:23

9. Hi I have a USB bluetooth that plug in my computer
View Tutorial          By: venkat c s at 2008-07-21 12:15:46

10. hey,m i suspend the process before start to execut
View Tutorial          By: koustubh nakate at 2010-04-01 22:16:16