A good answer might be:No. |
ConstantsOften in a program you want to give a name to a constant value. For example you might have a tax rate of 0.045 for durable goods and a tax rate of 0.038 for non-durable goods. These are constants, because their value is not going to change when the program is executed. It is convenient to give these constants a name. This can be done:
The reserved word final tells the compiler that the
value will not change.
The names of constants follow the same rules as the
names for variables.
(Programmers sometimes use all capital letters for constants;
but that is a matter of personal style, not part of the language.)
Now the constants can be used in expressions like:
But the following is a syntax error:
There are two big advantages to using constants:
|
QUESTION 15:Could ordinary variables be used for these two advantages? What is another advantage of using final? Click Here after you have answered the question |