I have been told to never use `==` for strings but for everything else because `.equals` would compare the values rather than the instances of the object. (Which I understand the difference of).

According to some sites, `==` compares memory locations?

What I don't understand is if you're comparing an integer with another, why would it compare memory locations, or is this just for strings?

If you're comparing int 3 to int 4 obviously it wouldn't be in the same memory location, but then if you're comparing int 4 to int 4, does that mean all integers with the value of 4 is stored in the same memory location?