Q: 8
The orderHelper class is a utility class that contains business logic for processing orders. Consider the
following code snippet:
A developer needs to create a constant named delivery_multiplier with a value of 4.15. The value of
the constant should not change at any time in the code.
How should the developer declare the delivery multiplier constant to meet the business objectives?
A developer needs to create a constant named delivery_multiplier with a value of 4.15. The value of
the constant should not change at any time in the code.
How should the developer declare the delivery multiplier constant to meet the business objectives?Options
Discussion
C vs B. I don't think B is right because 'constant' isn't a valid modifier in Apex. Salesforce uses static final for constants, so option C fits the pattern-makes it a true constant and class-level. Easy to overlook but that's a common trap on this exam. Correct me if I missed something, but C looks best here.
B tbh
Maybe B since 'constant' sounds right for a fixed value but not sure if Apex supports it.
Pretty sure I had something like this in a mock. B
Ugh, why can't Salesforce just let us use 'constant' like other languages? C imo
C , static final is the Apex way. B looks right if you code in other languages but it's a trap here.
C vs B
I'm still thinking B makes more sense since 'constant' looks like the right way to define an unchangeable value. Not totally sure if Apex treats it differently, but static/final together just feels more like Java. Open to other takes.
I'm still thinking B makes more sense since 'constant' looks like the right way to define an unchangeable value. Not totally sure if Apex treats it differently, but static/final together just feels more like Java. Open to other takes.
Be respectful. No spam.