This is actually explained briefly in the article you linked to, but I'm assuming you want an expanded answer.
When returning a nested collection (as
Contacts is in this example), Apex returns a defensive copy of the collection, rather than the actual collection. To simplify that further, each time you call
acct.Contacts the Contacts list is constructed fresh and will occupy a different location in memory.
Here is a simple example of how you could achieve this in your own class:
public class DefensiveListExample
private List<Contact> internalContacts;
public List<Contact> Contacts
return new List<Contact>(internalContacts);
Generally this type of behaviour is provided to prevent you violating invariants of classes and keep control of the collection within the class itself, or in languages like C# can be used to provide a read-only version of a collection.
=== compares the location in memory of the two compared objects, as opposed to the
== which compares the object types and fields of the objects.
Therefore, because the returned value of each call to
acc.Contacts resides in a different place in memory,
acct.Contacts === acct.Contacts is