Yes, the king can move out of check, provided that doing so is a
legal move (i.e. does not move into check again). If it cannot and
there is no other way to defend the check, then it is mate.
A checkmate occurs when the king is in a direct line of attack,
and also cannot move. If the king cannot move any piece but isn't
in a direct line of attack, it is a stalemate (tie)