go to previous page   go to home page   hear noise   go to next page

Answer:

The matching braces are indicated in color, below:


Matching Pairs

class Haiku
{
  public static void main ( String[] args )
  {
    System.out.println( "On a withered branch" );
    System.out.println( "A crow has just alighted:" );
    System.out.println( "Nightfall in autumn." );
  }
}

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.


QUESTION 20:

If a program is missing just one brace, will it compile?