Home > DeveloperSection > Interviews > What is blank final variable in java?

Posted on    April-01-2015 12:37 AM

 Java Java 
Ratings:
 1 Answer(s)
  466  View(s)
Rate this:

Mayank Tripathi
Mayank Tripathi

Total Post:807

Points:4035
Posted on    April-01-2015 1:15 AM

A final variable that is not initialized at the time of declaration is known as blank final variable.

If you want to create a variable that is initialized at the time of creating object and once initialized may not be changed, it is useful. For example PAN CARD number of an employee.

It can be initialized only in constructor.

class Student{  
int id;  
String name;  
final String PAN_CARD_NUMBER;  
...  
}  

Don't want to miss updates? Please click the below button!

Follow MindStick