function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
FabiFabi 

access modifiers

I am trying to learn apex and not understanding when to use "final" modifier . How does it differ from "static"?
appreiate your help!
Best Answer chosen by Fabi
Waqar Hussain SFWaqar Hussain SF
Hi Febi,
Final modifier indicates that the variable is constant, you can not override its value. 
See detail
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_final.htm

Let me know If you have any question.

All Answers

Waqar Hussain SFWaqar Hussain SF
Hi Febi,
Final modifier indicates that the variable is constant, you can not override its value. 
See detail
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_final.htm

Let me know If you have any question.
This was selected as the best answer
RakeshRakesh (Salesforce Developers) 
Difference between static and final variable:
https://success.salesforce.com/answers?id=90630000000hwALAAY
FabiFabi
Thank you all for your quick response, I understand these modifers better now. Will take a look at few examples as well.
Waqar Hussain SFWaqar Hussain SF
Please mark Best Answer for the most helpful answer, so the question is removed from the unsolved questions list.