== is also used for comparing the values of primitives. The equals method cannot be used directly on primitives (They must be wrapped).

int a = 5;
int b = 5;
if(a == b)
{
...