Javatpoint Logo

Difference between final and static variables

By: anjim2*** On: Fri Sep 08 10:29:22 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
Hi
where we can use the static and final variables?
and how it works?
Up0Down

 
Static block is used to initialise static data members.
It is executed before the main method at the time of class loading.
whereas the final keyword is uesd to restrict the user.It can be applied to a variable,a method or a class.
If a variable is declared as final,we cannot change its value.If a class is declared as final,the class cannot be inherited or extended by other class.
Image Created0Down

By: [email protected] On: Mon Sep 11 10:42:13 IST 2017 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No