In which two ways can the developer declare the variables to ensure their value can only be assigned one time?
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
Latest PDI Practice Questions with 191 Q&As
Updated Study Material | Instant Download | Detailed Answers and Explanations
Subscribe
Login
0 Comments