What is constant in Java 

What is constant in Java :- 

                           Normally, A constant does not change over time and has a fixed value. For example, the size of a shoe or cloth or any apparel will not change at any point. In an algebraic expression, x+y = 8, 8 is a constant value, and it cannot be changed.
                        But, in case of java Constant is A value which is fixed and does not change during the execution of a program. In other words, Java constants are fixed (known as immutable) data values that cannot be changed.

What is constant in Java


Characteristics of  Constant in java :-

  • Constant must be a global Variable.
  • Constant must be freely invoked within the same package & outside package.
  • Constant must be initialized.
  • The value of the Constant Can't be changed & modify.
  • In case of java we can't declared a constant by const keyword  but declared a constant by combining 3 keywords these are public, static, final.
  • When we declared a variable by public keyword that is freely invoked with in the same package and outside the package.
  • Java never permit the programmer to declare a Global Variable but we can declare astatic variable in java which is treated like a class variable.
  • In java static variable behaves like a global variable.
  • When the variable is static it invoke outside the class by the help of class name.
  • When the variable is declared by final keyword it is bound to be initialized in java.
  • The value of the final variable can't be Change or Modify.