If your king is in check, you must find a way to prevent the king from being captured. There are three ways to accomplish this.
Move the King
The first method is moving the king to safety. If the king can be moved to a square where it is not attacked, it no longer needs to fear being captured. In the diagram above, the white king can safely move to d2, e2, or f2, as the black rook only attacks the squares on the first rank.
Block the Check
The second method is blocking the check. This is also known as interposition. In the above diagram, white’s queen can be moved to c1, where it would block the check from black’s rook. Blocking is not an option when the attacking piece is a knight, as the knight can leap over any interposing piece.
Capture the Attacker
The final method is capturing the attacking piece. In the diagram above, white’s queen can capture the black rook on a1. With the rook off the board, the white king is once again safe.