For languages like C, C++, and Java, the command check-parens
will check parens (()
), brackets ([]
), and braces ({}
):
M-x check-parens <RET>
The point will move to a bracketing character that is unmatched, and the status line will report the problem.
It’s a good idea to use this in conjunction with show-paren-mode
as others have said.