<<< How to declare a class | Index | Data Types >>> |
To declare and initialize a variable in one statement, use the following syntax:
type variableName = value;
For example,
int scoreCounter = 1; // initialize an integer variable double unitPrice = 14.95; // initialize a double variable
Recall that int and double are primitive data types.
<<< How to declare a class | Index | Data Types >>> |