Valid PDI Dumps shared by ExamDiscuss.com for Helping Passing PDI Exam! ExamDiscuss.com now offer the newest PDI exam dumps, the ExamDiscuss.com PDI exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com PDI dumps with Test Engine here:
A developer is implementing an Apex class for a financial system. Within the class, the variables 'creditAmount' and 'debitAmount' should not be able to change once a value is assigned. In which two ways can the developer declare the variables to ensure their value can only be assigned one time? Choose 2 answers
Correct Answer: B,C
* Why Usefinal? * Thefinalkeyword ensures that a variable's value can only be assigned once. * Option B: Assigning the value in the constructor is valid as it allows for flexibility when creating class instances. * Option C: Assigning the value directly when declaring the variable is also valid for constants. * Why Not Other Options? * A: Static variables can have their values reassigned unless marked as final. * D: Static variables cannot be assigned within a class constructor. References:Apex Final Keyword:https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_final.htm