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:
- It improves the readability of the program and makes it easier for someone to understand the code.
- Any unintentional changes to such variables are flagged by the compiler.
- 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
If you want to change the precedence of operations in an expression, which symbols do you use?
How can you write single line comments in Java?
Write a Java constant declaration that gives the name TAX_RATE to the value 15%.
What is the output produced by the following lines of program code?
char x, y; x = 'y'; System.out.println(x); y = 'z'; System.out.println(y); x = y; System.out.println(x);