final Keyword in Java


final variables cannot be reassigned once initialized.

Source Code

final int x = 10;
// x = 20; // This will cause a compile-time error
System.out.println(x);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments