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. hey i need a sms recieving code....
View Tutorial          By: Kishore at 2009-08-06 09:11:13

2. excellent
View Tutorial          By: alok mishra at 2008-05-12 00:51:57

3. I have loaded allthe 5 java files.But how to imple
View Tutorial          By: ashish at 2007-03-08 20:33:11

4. i want to SCJP exam ,tell how to apply for this ex
View Tutorial          By: jasmina at 2013-04-22 11:05:53

5. Quite Helpful.....
^_^

View Tutorial          By: Alfred_Septio at 2012-09-26 12:38:47

6. Everything is running.... But it doesn't send....<
View Tutorial          By: uu at 2009-04-09 18:10:13

7. This is great, hope to learn more from this commun
View Tutorial          By: Wamaguru at 2014-07-12 09:05:30

8. please am in Nigeria, i need to know how to send a
View Tutorial          By: kay at 2009-10-15 03:06:10

9. Please give me a example of regionMatches().
View Tutorial          By: A. K. M. Saleh Sultan at 2009-10-05 14:52:25

10. Nice one....
View Tutorial          By: vinod at 2010-05-06 23:36:15