Posts

Showing posts with the label Final

Types of Final Variable in Java

Final Variable Before knowing types of final variable you should know What is a Final Variable? Final variable is a variable which  is declared using final keyword before it. For example, Class Tst  {    int final var1 = 10; // var1 is declared as final variable... } There are two very important related to Final Variables that are- 1. Final Variable's value never changes. 2. Final variable must be declared during declaration time. Now, we will discuss about Types of Final variable. There are following types of final variables- 1. Final Instance Variable 2. Final Static Variable 3. Final Local Variable 4. Final Block Level Variable 5. Final Parameterized Variable 1. Final Instance Variable  -   Those variables which are declared as Final Instance i.e. Final                                           ...