Small Java Programs
20. Matching Pairs
Answer:
The matching braces are indicated in color, below:
Matching Pairs
|
Notice that in addition to pairs of braces that match, there are pairs of parentheses ()
, and pairs of brackets []
that match. Large programs will have many of these matching pairs, which are used to group sections of the program together.
Format your program as you write it. This helps you see the logic you are creating, and is a tremendous help in programming.
Text editors intended for program creation (called program editors) and more sophisticated programming environments always have ways to show matching braces. This is really valuable. You should definitely learn to use this feature with whatever editor or environment you are using.
Notepad++ has become a World-favourite programming editor for Windows. It has sophisticated brace matching and automatic indenting. It can easily be used with the JDK environment. Get it at Notepad++
Question 20:
If a program is missing just one brace, will it compile?