The Java constants used to use values \u200b\u200b data types that will be constant during program execution, unlike variables that can be modified at any time.
Once assigned to a constant value, it can not be changed later.
is not necessary to start the value of a constant declaration time, but once you assign a value to that constant, this value can not be modified.
The name that identifies a constant identifier is called .
To declare a constant using the keyword final , then define the data type and then writes the identifier of the constant.
DECLARE CONSTANT NOT STARTED
final int age;
declare several constants
NOT STARTED
final float a, b, c;
AND BEGIN DECLARE AT A TIME CONSTANT
final
double size = 1.72;
MULTIPLE CONSTANT AND BEGIN DECLARE BOTH
final boolean a = true, b = false, c = false;
0 comments:
Post a Comment