Does word "cup" have the same meaning in the following two sentences?

He swore as the ball rimmed the cup and rolled away.

He drank a cup of coffee.
different meanings