The following song contains first and second endings. The first time you play through the song, play the first ending (Z), then go back to the beginning. The second time you play through the song, play the second ending (X) instead of the first. Notice also the use of dotted quarter notes in bars 3 and 5.
Here is another song which uses first and second endings. In this one, the second ending leads into a whole new section.