Wednesday, October 29, 2014

What is a constant ?



A constant or const variable behaves as a variable. We give it an initial value and can use it wherever we can use a variable.
Unlike a variable, we are not allowed to change the value of a const. The change is an assignment statement.  
We have to initialize the const variable at the time of creation. We are not allowed to initialize it later in our program. A constant is static by default and we cannot use the instance reference

No comments:

Post a Comment