Java Program using final variable
In this program, You will learn how to implement a final variable in java.
final int x = 10;
Example: How to implement a final variable in java.
class Main {
final int x = 10;
void display() {
System.out.println("x value is :" + x);
}
public static void main(String args[]) {
Main t = new Main();
t.display();
}
}
Output:
x value is :10