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



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. can u pls tell me how to retrive data from databas
View Tutorial          By: yogesg desai at 2010-05-27 08:26:24

2. i want some explanation about struts form field va
View Tutorial          By: ramizah at 2007-10-03 23:40:11

3. FINALLY! A place that gives complete examples (wi
View Tutorial          By: bminton at 2013-03-19 00:15:55

4. excellent
View Tutorial          By: santosh at 2012-08-28 06:12:44

5. Guys, txtWeb is back with their National Level Dev
View Tutorial          By: rahul.del at 2012-08-16 10:01:09

6. i am newly in java, i want to learn about this and
View Tutorial          By: gelen at 2010-11-23 02:57:15

7. can i ask a program that will compute a order from
View Tutorial          By: mjae at 2011-09-12 08:02:46

8. Really nice explanation...
nice to understa

View Tutorial          By: Parth Kansara at 2011-06-21 02:11:52

9. Excellent work mate! works like a charm! Lifesaver
View Tutorial          By: jmcg at 2015-01-29 02:31:56

10. I've been satisfied with your tutorial site. Since
View Tutorial          By: Mark Harold F. Manguino at 2008-08-06 05:00:54