I am trying to understand better UML with the help of my knowledge of entity-relationship modeling.
How do association classes work in the class diagram? I understand that they have their own characteristics but differ from other classes because they represent a connection.
So can they be considered as weak entities in a certain sense?
An UML association class is at the same time an association and a class. Since it is also a class, it means that its instances have their own identity. Since it is also an association, the existance of the link depends on the existance of the linked instances.
An ERD weak entity is an entity that depends on the existance of another entity, and whose identity makes only sense together with the identity of that other entity.
These are therefore two independent and unrelated concepts. You could for example implement an association class in a relational database scheme that could be modelled in ERD as a strong entity, with a surrogate key and total participation with the associated entities or as a weak entity with a compound key including at least one of the owning entity's key.
The closest concept to an association class in ERD is the associative entity.