final variable - what is it ?

  1. Final variables are written in capital letters as per the standards.

  2. Final variables cannot be modified.

  3. Final variables don’t have any default value, without initializing and printing it will give an error.

  4. When used Inside the Method, final Variables can be written without initialization and can also be initialized later.

    Whereas, when used Inside as Class Member, final Variables cannot be written without initialization plus they can’t get initialized later.

0
Subscribe to my newsletter

Read articles from Preetika Prakash directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Preetika Prakash
Preetika Prakash

Attempting #100DaysofCode challenge | Open Source Contributor