Final answer:
Heat flows from the warmer object to the cooler object.
Step-by-step explanation:
When objects at disparate temperatures come into contact, thermal energy redistributes, obeying the second law of thermodynamics. In this scenario, Object A, registering at 40°C, is comparatively cooler than Object B, which stands at 80°C. Consequently, heat spontaneously transfers from the warmer Object B to the cooler Object A. This directional heat flow results in Object B experiencing a loss of thermal energy, while Object A gains thermal energy, striving to establish thermal equilibrium between the two. This fundamental principle underscores the natural tendency of systems to move towards a state of balanced thermal energy distribution, reflecting the intrinsic laws governing heat transfer.