Fifteen

I was playing a game the other day when a situation came up. My friend told me that you can get points for fifteen in a couple of ways. For instance,

Player 1: Plays a 10
Player 2: Plays a 5
Player 1: Plays a King

He told me that the Player 1 would also get 2 points for the last card (King plus 5).

Another situation would be:

Player 1: Plays a 7
Player 2: Plays a 8
Player 1: Plays a 7

Can some please clarify if that is right? We are fairly new to cribbage so any help you could offer would be much appreciated.