nerdexam
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)
  • A
    13% (3)
  • B
    4% (1)
  • C
    75% (18)
  • D
    8% (2)

Community Discussion

No community discussion yet for this question.

Full CRT-450 Practice