Two objects in physical contact with each other are in thermal equilibrium when they reach the same temperature and an exchange of heat energy no longer occurs. According to HyperPhysics, the relation of thermal equilibrium follows the Zeroth Law of Thermodynamics, which states that “if two systems are at the same time in thermal equilibrium with a third system, they are in thermal equilibrium with each other.”
When a hotter object is placed in contact with a cooler object, the hotter object transfers heat energy to the cooler object. This process causes the hotter object to cool and the cooler object to become warmer.
This exchange of energy continues until the two objects have the same temperature or are in a state of equilibrium.
To illustrate this, take for example a cup of hot water (system A) and a cup of cold water (system B) that are left in a room (surroundings). The process that occurs between the cup of hot water (system A) and the room (surroundings) is exothermic because heat energy is lost. Conversely, the process that occurs between the cup of cold water (system B) and the room (surroundings) is endothermic because heat energy is absorbed by the cup of cold water. Eventually, all three reach the same temperature, the temperature of the room.
It is important to note that whenever two objects of different temperatures are placed in contact with each other, energy from warmer objects always moves to the cooler objects. In this respect, the direction of energy transfer does not depend on the amount of energy, only the temperatures involved.