Salesforce Platform Developer I (legacy) — Question 55
Which statement results in an Apex compiler error?
Answer options
- A. Map<Id,Leas> lmap = new Map<Id,Lead>([Select ID from Lead Limit 8]);
- B. Date d1 = Date.Today(), d2 = Date.ValueOf('2018-01-01');
- C. Integer a=5, b=6, c, d = 7;
- D. List<string> s = List<string>{'a','b','c');
Correct answer: D
Explanation
Option D is incorrect because it uses a mismatched parenthesis, which will lead to a syntax error during compilation. The other options are syntactically correct and do not result in any compilation errors.