Question: User-defined identifiers come in 3 types: classes, methods, and variables. Follow the coding rules for identifiers. Keep in mind that method identifiers usually begin with
User-defined identifiers come in 3 types: classes, methods, and variables. Follow the coding rules for identifiers. Keep in mind that method identifiers usually begin with an action word.
Here are the coding formats for each type of identifier:
| Identifier Type | Format | Example |
| Class: | accessModifier class nameOfClass | public class Employee |
| Method: | accessModifier static returnType nameOfMethod() | public static void hireEmployee() |
| Variable: | dataType nameOfVariable = initialValue; | String employee = ; |
| Code a variable that stores the cost of a new computer. |
|
| Code a class header for a program about diseases. |
|
| Code a method header for driving a stick-shift. |
|
| Code a variable that stores the model of a car. |
|
| Code a class header for a program about universities. |
|
| Code a method header for Christmas shopping. |
|
| Code a class header for a program about the Olympics. |
|
| Code a method header for timing a one-mile relay. |
|
| Code a variable that stores the best place to retire. |
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
