
Please give some easiest and understanding example program for final variable?

A final variable is a variable which has been initialized to a fixed value which cannot be changed after initialization. Once created, its value cannot be changed.
public class FinalVariable{
public static void main(String[] args) {
final int hoursInDay=24;
//IF you will try to change the value by the following statement, you will get error bcoz final value can't be changed.
//hoursInDay=12;
System.out.println("Hours in 5 days = " + hoursInDay * 5);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.