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. steps 2 create and use tiles
View Tutorial          By: sasank at 2008-10-03 08:06:43

2. Good stuff.
View Tutorial          By: flazwbooks at 2010-07-18 05:50:50

3. Hi, it looks great!
I'm just starting with

View Tutorial          By: Bertrand at 2013-04-28 19:20:42

4. Can u tall me about the job market of J2ME.
View Tutorial          By: mimdad07 at 2009-06-26 14:40:26

5. Thanks sir i am understand to jdbc but who will ru
View Tutorial          By: Ranjeet singh at 2012-05-04 07:40:29

6. great material for language
View Tutorial          By: hafiz at 2015-03-24 12:18:45

7. gud example, we welcome you
View Tutorial          By: jasim Khalid almurakh meherbani at 2010-09-20 03:14:25

8. Impressing answer guys...
View Tutorial          By: Jayeeta Pal at 2011-06-28 03:18:26

9. Hi
I tried to use this class , I don't get

View Tutorial          By: arnav at 2015-03-27 06:01:22

10. THANKS you for having this site. it help me a lot
View Tutorial          By: fermilita at 2012-01-04 11:45:53