KnowledgeBoat Logo

Computer Applications

What are symbolic constants? How are they useful in writing programs?

Values & Data Types Java

18 Likes

Answer

Memory locations whose values cannot be changed within a program are called constants or symbolic constants. The advantages of symbolic constants are:

  1. It improves the readability of the program and makes it easier for someone to understand the code.
  2. Any unintentional changes to such variables are flagged by the compiler.
  3. Later, if there is a change in the value of such variables (e.g. interest rate changed), you just need to modify its value at one place and all the other occurrences will be taken care of automatically.

Answered By

8 Likes


Related Questions