Salesforce Platform Developer I (legacy) — Question 94

Which is a valid Apex assignment?

Answer options

Correct answer: C

Explanation

Option C is correct because it assigns an integer value to a Double variable, which is valid in Apex. Options A and B are incorrect as they attempt to assign a floating-point number to an Integer type, which is not allowed. Option D is also incorrect since it assigns a floating-point value to a Float type, but Float is less commonly used in Apex compared to Double.