Getting Started

  • What is Trailhead
  • myTrailhead
  • Trailblazer Community
  • Career Growth

Learn

  • Trails
  • Trailmixes
  • Modules
  • Projects

Credentials

  • Superbadges
  • Certifications
  • Maintain Certifications

Salesforce

  • Salesforce.com
  • AppExchange
  • Developers
  • Help Portal
© 2026 Salesforce, Inc. All rights reserved. Privacy Terms of Use Trust Accessibility Cookie Preferences
SalesforceTrailhead
  • Today
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';
  }
}
Verify StepDemo check
Next unit Call an Apex Method