1.7k views
5 votes
What symbol is used to start and finish both a class's code and a method's code?

a. Parenthesis: ()
b. Semi colon: ;
c. Square brackets: [ ]
d. Curly braces: {}

1 Answer

6 votes

Final answer:

Curly braces {} are used to start and finish the code for a class or method, defining their scope.

Step-by-step explanation:

The symbols used to start and finish both a class's code and a method's code in most programming languages, such as Java, C++, and C#, are the curly braces: {}. A class or method begins with an opening curly brace { and ends with a closing curly brace }. These braces define the scope of a class or method, meaning they indicate where the code for that class or method starts and finishes.

The other options given, such as parentheses (), semi-colons ;, and square brackets [], have different uses in code, such as surrounding parameters in methods (parentheses), ending statements (semi-colons), and denoting arrays (square brackets).

User Omnichord
by
8.4k points