Create an Apex Class
Create a simple Apex class in our Code Builder project.
- Press Command+Shift+P (⇧⌘P) to open the command palette.
- Select SFDX: Create Apex Class to create a Lightning web component.
- Enter
HelloWorldApex
for the Apex class file name. - Press Enter to accept the default file location (
force-app/main/default/classes
). - 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.
- In
HelloWorldApex.cls
, copy and paste the following code:
- Press Command+S (⌘S) to save the Apex class.