English

Explain the features of Constants.

Advertisements

Questions

Explain the features of Constants.

Explain the features of Constants in JAVA.

Explain
Advertisements

Solution

  1. Fixed Value: A constant stores a value that cannot be changed once it is assigned.
  2. Declaration: Constants are declared using the final keyword in Java.
  3. Data Type: Every constant has a specific data type, such as int, float, double or char.
  4. Initialisation: A constant must be assigned a value before it is used, and it can be assigned only once.
  5. Memory Allocation: Constants occupy memory according to their data types.
  6. Naming Convention: Constant names are generally written in uppercase letters, with underscores separating words.
  7. Program Reliability: Constants prevent accidental changes to fixed values, making programs more reliable and easier to maintain.
shaalaa.com
  Is there an error in this question or solution?
Chapter 6: Variables and Expressions - EXERCISE [Page 131]

APPEARS IN

Dheeraj Mehrotra Computer Science [English] Class 12
Chapter 6 Variables and Expressions
EXERCISE | Q 7. (ii) | Page 131
Dheeraj Mehrotra Computer Science [English] Class 12
Chapter 6 Variables and Expressions
EXERCISE | Q 13. | Page 131
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×