In which two ways can the developer declare the variables to ensure their value can only be assigned one time?

Posted by: Pdfprep Category: PDI Tags: , ,

A developer is implementing an Apex class for a financial system. Within the class, the variables ‘creditAmount’ and ‘debtAmount’ 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
A . Use the static keyword and assign its value in the class constructor.
B . Use the final keyword and assign its value in the class constructor.
C . Use the static keyword and assign its value in a static initializer.
D . Use the final keyword and assign its value when declaring the variable.

Answer: B,D