Create an Apex Class

Create a simple Apex class in our Code Builder project.

  1. Press Command+Shift+P (⇧⌘P) to open the command palette.
  2. Select SFDX: Create Apex Class to create a Lightning web component.
  3. Enter HelloWorldApex for the Apex class file name.
  4. Press Enter to accept the default file location (force-app/main/default/classes).
  5. Press Enter.

The Apex class is created in the force-app/main/default/classes/HelloWorldApex folder.

Update the Apex class to add a method with a simple greeting.

  1. In HelloWorldApex.cls, copy and paste the following code:
  1. Press Command+S (⌘S) to save the Apex class.