Salesforce Platform Developer I (legacy) — Question 197
Which code statement includes an Apex method named updateAccounts in the class AccountController for use in a Lightning web component?
Answer options
- A. import updateAccounts from 'AccountController';
- B. import updateAccounts from ‘@salesforce/apex/AccountController.updateAccounts';
- C. import updateAccounts from 'AccountController.updateAccounts';
- D. import updateAccounts from ‘@salesforce/apex/AccountController’;
Correct answer: B
Explanation
Option B is correct because it correctly specifies the path to the Apex method using the required syntax for importing Apex methods in Lightning web components. The other options either omit the correct namespace ('@salesforce/apex') or incorrectly format the import statement, making them invalid for this context.