Salesforce
CRT-450 · Question #24
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…
Sign in or unlock CRT-450 to reveal the answer and full explanation for question #24. The question stem and answer options stay visible for context.
Question
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
Options
- AUse the static keyword and assign its value in the class constructor.
- BUse the final keyword and assign its value in the class constructor.
- CUse the static keyword and assign its value in a static initializer.
- DUse the final keyword and assign its value when declaring the variable.
Unlock CRT-450 to see the answer
You've previewed enough free CRT-450 questions. Unlock CRT-450 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.