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. import java.io.*;
import java.util.*;

View Tutorial          By: srikanth at 2014-05-30 06:44:58

2. How to fetch a value from a database in dropdown b
View Tutorial          By: lara at 2014-11-19 09:02:43

3. hi,this is nishad from india.....
i have a

View Tutorial          By: NISHAD at 2008-09-06 09:23:15

4. This is first time i am using this net
View Tutorial          By: selvam at 2008-08-19 00:04:44

5. Hi
I have been trying for the same thing f

View Tutorial          By: Zaid Kazi at 2012-01-30 15:43:46

6. Hi,
What is the process if I want to know w

View Tutorial          By: Koushik Roy at 2012-07-13 05:35:35

7. i need help for my study, i need an algorithm for
View Tutorial          By: Vincent at 2011-08-17 13:37:52

8. Thanks..
It is so easy to understand...

View Tutorial          By: Rahul Meshram at 2008-09-11 13:18:41

9. my host is 202.148.202.3.Could not connect to SMT
View Tutorial          By: Anbuselvam at 2012-05-04 04:52:17

10. it is gooo...very helpful to know the basics
View Tutorial          By: srikanth at 2010-08-24 00:38:57