Question: 2 . 8 Creating Named Constants with final CONCEPT: The final key word can be used in a variable declaration to make the variable a

2.8 Creating Named Constants with
final
CONCEPT: The final key word can be used in a variable declaration
to make the variable a named constant. Named constants are initialized
with a value, and that value cannot change during the execution of the
program.
Assume that the following statement appears in a banking program that
calculates data pertaining to loans:
amount = balance *0.069 ;
In such a program, two potential problems arise. First, it is not clear to
anyone other than the original programmer what 0.069 is. It appears to be
an interest rate, but in some situations there are fees associated with loan
payments. How can the purpose of this statement be determined without
painstakingly checking the rest of the program?
2 . 8 Creating Named Constants with final

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!