below is my markup. when i move the mouse over the hyperlinks they get underlined and turn red. but if i swap the order of the last two rules, the hyperlinks still get underline
If the rules are equal in specificity (in this case they are), individual rules get overridden in the order they're defined in the CSS, so in your example red wins because it comes later in the CSS definitions. The same rule applies in other cases as well, for example:
Which of these wins?
.green { color: green; }
.red { color: red; }
.red
wins here, it doesn't matter the order in the class
attribute, all that matters is the order the styles are defined in the CSS itself.