SalesforceTrailhead
  • Today
© 2026 Salesforce, Inc. All rights reserved. Privacy Terms of Use Trust Accessibility Cookie Preferences
Quick Start: Apex

Create an Apex Class

+200 Points~10 minsHands-On ChallengeCompleted
Quick Start: ApexCreate an Apex Class

Org:Mindful Goat Playground

Topics

  • Create the Class

Looking for help?

Explore Help ResourcesShare Your Feedback
Learning Objectives

After completing this unit, you'll be able to:

  • Create an Apex class.
  • Add a method that returns a value.

Create the Class

  1. Open the Developer Console from the quick access menu.
  2. Click File > New > Apex Class and name it HelloWorld.
  3. Add a public static method greet that returns the string Hello, Trailblazer.
  4. Save.
public class HelloWorld {
  public static String greet() {
    return 'Hello, Trailblazer';
  }
}
Check StepDemo check
Next Unit Call an Apex Method