Variable: Varaible value can be change any time. it cant be fix.
Constant: Constant value can not be change. Constants can be defined using the final keyword, which means that the variable can be assigned at most once, either in the declaration itself, or with a static initializer method if the constant is defined in a class.
The main diffrence between variable and Constant.
Variable: Varaible value can be change any time. it cant be fix.
Constant: Constant value can not be change. Constants can be defined using the final keyword, which means that the variable can be assigned at most once, either in the declaration itself, or with a static initializer method if the constant is defined in a class.
How to declare Variable and Constant:
Varaible:
Public Integer fstNumber;
Constant:
static final Integer fstNumber=10;
OR
static final Integer fstNumber;
static{
fstNumber=10;
}