Download Lecture PowerPoint Chapter 2-2

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
***** SWTJC STEM *****
•
Declaring a Constant
To declare and assign a value to a constant, use . . .
final datatype CONSTANT_NAME = VALUE;
•
final means exactly that. Once the constant is assigned a value,
it cannot change!
•
Examples:
•
•
final double PI = 3.14159; assigns double constant PI the
value 3.14159.
•
final int I_COUNT_MAX = 1000; assigns constant
I_COUNT_MAX the value 1000.
Remember that constant names are all caps with multiple names
separated by underscores!
Chapter 2-2 cg 27