Salesforce
CRT-450 · Question #62
A developer has an integer variable called maxAttempts. The developer meeds to ensure that once maxAttempts is initialized, it preserves its value for the lenght of the Apex transaction; while being…
The correct answer is C. Declare maxattempts as a constant using the static and final keywords. See the full explanation below for the reasoning.
Question
A developer has an integer variable called maxAttempts. The developer meeds to ensure that once maxAttempts is initialized, it preserves its value for the lenght of the Apex transaction; while being able to share the variable's state between trigger executions. How should the developer declare maxAttempts to meet these requirements?
Options
- ADeclare maxattempts as a member variable on the trigger definition.
- BDeclare maxattempts as a private static variable on a helper class
- CDeclare maxattempts as a constant using the static and final keywords
- DDeclare maxattempts as a variable on a helper class
How the community answered
(24 responses)- A13% (3)
- B4% (1)
- C75% (18)
- D8% (2)
Community Discussion
No community discussion yet for this question.