These are the ways of creating Apex Class in salesforce.
Directly we are creating the apex class in salesforce Org.
And also, we can create the apex class in the Developer console.
We can Create an apex class through the Visual Studio code.
Directly create the apex class in Salesforce :
- Open to the Salesforce Org.
- Enter Apex Classes in the Quick Find box.
- And choose the Apex class. You can see the name of the class in your org.
- Now we create a newApex class, so we click the New button.
- Now we create a new Apex class, so we click the New button.
- Type your Apex Code here once you will complete your code After that you will click Save Button.
How to create apex class in Visual studio code :
Visual Studio Code is the latest IDE (integrated development environment) for Salesforce Development.
- Right click the classes tab and choose the Create apex class option.
- Now created the apex class. Then write your code and save this file.
- Finally, you will complete the apex class and right-click and deployed code in your Class.
- And go to your salesforce Org and refresh the page then we will see the new apex class in your org.
How to create apex class in Developer console :
- Open your Salesforce ORG.
- Click the Gear Icon (Setup Button) in the right side top corner.
- Then choose the Developer Console.
- Click File -> New -> Apex Class.
- Then type your apex class name and click File -> Save.
- Here type your apex code.
- Click File -> Save to save Apex class.