> 
> **Possible Duplicate:**  
> 
> [How Does the toString(), ==, equals() object methods work differently or similarly on reference and primitive types?](https://stackoverflow.com/questions/1586223/how-does-the-tostring-equals-object-methods-work-differently-or-similarl) 
> 
> 
> 

I am trying to understand the difference between == and equals to operator in Java.
e.g. == will check if it is the same object while equals will compare the value of the object ... Then why do we use == for comparing primitive data types like int. 
Because if I have 

```
   int i =7; //and 
   int j = 6. 

```

They are not the same object and not the same memory address in stack. Or does the == behaves differently for primitives comparison.??