Jul 10, 2024
final
keywordCONSTANT_NAME
)final data_type CONSTANT_NAME = value;
final String COMPANY_NAME = "Nazar Academy";
System.out.println(COMPANY_NAME);
Nazar Academy
final String COMPANY_NAME = "Nazar Academy";
System.out.println(COMPANY_NAME);
COMPANY_NAME = "Another Name"; // Error: Cannot assign a value to final variable
final String COMPANY_NAME;
COMPANY_NAME = "Nazar Academy"; // First-time assignment allowed
Nazar
instead of Nazar
final String COMPANY_NAME = "Nazar Academy"; // Corrects mistake everywhere
End of Lecture