{"id":1208,"date":"2026-09-02T15:00:00","date_gmt":"2026-09-02T09:30:00","guid":{"rendered":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/"},"modified":"2026-09-02T15:00:00","modified_gmt":"2026-09-02T09:30:00","slug":"what-is-salesforce-apex-first-class","status":"publish","type":"post","link":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/","title":{"rendered":"What is Salesforce Apex? Your First Apex Class"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Salesforce Apex is the programming language that runs inside Salesforce, and almost every developer job asks for it. In this post, you will learn what Apex does and how it runs. Then you will write your very first Apex class.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This post starts Level 2 of our developer series. You already know <a href=\"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-development\/\">what Salesforce development is<\/a> and when to choose <a href=\"https:\/\/swapnilzambare.com\/blog\/declarative-vs-programmatic-salesforce\/\">clicks or code<\/a>. You also have your tools ready from the <a href=\"https:\/\/swapnilzambare.com\/blog\/salesforce-cli-setup-vs-code\/\">Salesforce CLI setup<\/a>. Now it is time to write real code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is Salesforce Apex?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Salesforce Apex is a strongly typed, object-oriented programming language made by Salesforce. It runs on Salesforce servers, not on your computer. You use it to add business logic that clicks cannot handle, such as complex rules, triggers and integrations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8220;Strongly typed&#8221; means every variable has a fixed type, such as a number or text. &#8220;Object-oriented&#8221; means you organise code into classes, which bundle data and actions together. If you have seen Java or C#, Apex will look familiar.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Think of Salesforce as a smart office building. Flow is like the building&#8217;s ready-made switches and timers. Apex is like hiring an electrician who can wire anything you need, exactly how you want it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Learn Salesforce Apex?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Clicks cover a lot, but real projects always hit their limits. That is when teams need Salesforce Apex. Here are common jobs that Apex handles well.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Running custom logic before or after a record saves, using triggers.<\/li>\n\n<li>Processing thousands of records in the background with batch jobs.<\/li>\n\n<li>Calling outside systems, such as a payment or SMS service.<\/li>\n\n<li>Building custom REST services that other apps can call.<\/li>\n\n<li>Powering Lightning Web Components with server-side data.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">So learning Salesforce Apex opens most developer roles. It is also the main topic of the Platform Developer I exam.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Salesforce Apex Works<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You write Apex in VS Code or the Developer Console. When you save or deploy, Salesforce compiles it on its servers. Then the platform stores the compiled code as metadata in your org.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-1-1024x640.png\" alt=\"Salesforce Apex diagram showing how code is written, compiled, stored and run\" class=\"wp-image-1206\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-1-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-1-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-1-768x480.png 768w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-1-1536x960.png 1536w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-1-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">How Salesforce Apex works, from writing code to commit or roll back.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When something triggers the code, such as a user saving a record, Salesforce runs it. The code can read and change data, and then the transaction finishes. If any error happens, Salesforce rolls back the whole transaction, so no half-saved data stays behind.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Apex Runs in a Shared Platform<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">As you learned in our post on <a href=\"https:\/\/swapnilzambare.com\/blog\/salesforce-multi-tenant-architecture-metadata\/\">multi-tenant architecture<\/a>, many orgs share the same servers. So Salesforce Apex has governor limits. For example, one synchronous transaction can run up to 100 SOQL queries. You will learn to write code that stays well inside these limits.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Where Apex Code Lives<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Apex lives in a few kinds of files. The table below shows the main ones and when each one runs.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Apex file type<\/th><th>What it is<\/th><th>When it runs<\/th><\/tr><\/thead><tbody><tr><td>Class<\/td><td>A reusable block of code<\/td><td>When something calls it<\/td><\/tr><tr><td>Trigger<\/td><td>Code tied to an object<\/td><td>Before or after a record saves<\/td><\/tr><tr><td>Anonymous Apex<\/td><td>Code you run once<\/td><td>When you click Execute<\/td><\/tr><tr><td>Test class<\/td><td>Code that tests other code<\/td><td>When you run tests<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">When Salesforce Apex Runs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Apex never runs on its own. Something always starts it, and developers call that an entry point. Knowing the entry points helps you plan where your code should live.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Triggers fire when a user saves a record.<\/li>\n\n<li>Flows call an invocable Apex method for hard logic.<\/li>\n\n<li>Lightning Web Components ask an Apex method for data.<\/li>\n\n<li>Scheduled jobs run at a set time, such as every night at 2 AM.<\/li>\n\n<li>Outside systems call a custom Apex REST service.<\/li>\n\n<li>Developers run anonymous Apex in the Developer Console.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In Salesforce Apex, each entry point starts a new transaction with its own limits. For example, a nightly batch job gets fresh limits for each chunk of records it processes. We will cover these entry points one by one later in the series.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Salesforce Apex and Flow Together<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Apex and Flow are not rivals. In fact, many of the best solutions use both. An admin builds the main flow with clicks, and a developer writes one Apex action for the hard part.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, Bright Path Tutors may want a screen flow that enrols a student. The flow handles the screens and simple updates. However, the fee calculation has many rules, so the flow calls an Apex method to work it out. As a result, admins can still change the screens without touching code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Building Blocks of Apex<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every Apex program uses the same small set of ideas. We will cover each one in its own post in this level. For now, here is a quick view so you know what is coming.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Variables and Data Types<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A variable is a named box that holds a value. Each box has a type, such as <code>Integer<\/code> for whole numbers or <code>String<\/code> for text.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Statements and Logic<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Apex uses <code>if<\/code>, <code>switch<\/code> and loops to make decisions and repeat work. Each statement ends with a semicolon.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Collections<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Lists, sets and maps hold many values at once. They are the heart of bulk-safe code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Classes and Methods<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A class groups related code. A method is one action inside a class, like <code>getMessage<\/code> or <code>calculateFee<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Salesforce Apex vs Java<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Many people ask how Apex compares to Java. They look alike, but they live in very different places. The table below shows the key differences.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Feature<\/th><th>Apex<\/th><th>Java<\/th><\/tr><\/thead><tbody><tr><td>Where it runs<\/td><td>Only on Salesforce servers<\/td><td>Almost anywhere<\/td><\/tr><tr><td>Database access<\/td><td>Built in with SOQL and DML<\/td><td>Needs extra libraries<\/td><\/tr><tr><td>Limits<\/td><td>Governor limits per transaction<\/td><td>Limited by your server<\/td><\/tr><tr><td>Testing rule<\/td><td>75% coverage to deploy to production<\/td><td>No platform rule<\/td><\/tr><tr><td>Case sensitive<\/td><td>No<\/td><td>Yes<\/td><\/tr><tr><td>Best for<\/td><td>Salesforce business logic<\/td><td>General software<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When to use which is simple. Use Apex for logic inside Salesforce, and use Java or other languages for apps outside it.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-2-1024x640.png\" alt=\"Salesforce Apex diagram comparing Apex with Java\" class=\"wp-image-1207\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-2-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-2-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-2-768x480.png 768w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-2-1536x960.png 1536w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-diagram-2-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Salesforce Apex vs Java: where each runs and what each is best for.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Your First Apex Class<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s write a real class for our practice company, Bright Path Tutors. The class will build a welcome message for a course and calculate a fee after a discount.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open your <code>brightpath-app<\/code> project in VS Code.<\/li>\n\n<li>Press Ctrl+Shift+P and run &#8220;SFDX: Create Apex Class&#8221;.<\/li>\n\n<li>Name it <code>CourseHelper<\/code> and accept the default folder.<\/li>\n\n<li>Replace the file content with the code below and save it.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>public with sharing class CourseHelper {\n\n    \/\/ Builds a friendly welcome line\n    public static String welcome(String studentName, String courseName) {\n        return 'Hi ' + studentName + ', welcome to ' + courseName + '!';\n    }\n\n    \/\/ Returns the fee after a percentage discount\n    public static Decimal feeAfterDiscount(Decimal fee, Decimal percent) {\n        Decimal discount = fee * percent \/ 100;\n        return fee - discount;\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s read it line by line. The <code>public<\/code> keyword means other code in the org can use this class. Next, <code>with sharing<\/code> tells Apex to respect the user&#8217;s record access. Then <code>static<\/code> lets you call a method without creating an object first. Each method declares a return type, <code>String<\/code> or <code>Decimal<\/code>, and returns a value of that type.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next, deploy the class. Right-click the file and choose &#8220;SFDX: Deploy This Source to Org&#8221;. You can also run <code>sf project deploy start --source-dir force-app\/main\/default\/classes<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Run Your First Apex Code<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now let&#8217;s call the class. Open the Developer Console and press Ctrl+E to open the anonymous window. Paste this code, tick &#8220;Open Log&#8221; and click Execute.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>String msg = CourseHelper.welcome('Asha', 'Apex Basics');\nSystem.debug(msg);\n\nDecimal finalFee = CourseHelper.feeAfterDiscount(5000, 10);\nSystem.debug('Fee after discount: ' + finalFee);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first line calls <code>welcome<\/code> and stores the result in a <code>String<\/code> variable. The <code>System.debug<\/code> line writes it to the log. Then the code calls <code>feeAfterDiscount<\/code> with a fee of 5000 and a 10% discount. Tick &#8220;Debug Only&#8221; in the log, and you will see these lines.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>USER_DEBUG [2]|DEBUG|Hi Asha, welcome to Apex Basics!\nUSER_DEBUG [5]|DEBUG|Fee after discount: 4500<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Well done, you have written and run your first Salesforce Apex class. Now try a different student name and a 25% discount, then run it again. Small changes like this build confidence fast.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Salesforce Apex Syntax Rules<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Salesforce Apex has a few rules that trip up beginners. Learn them early, and you will see far fewer compile errors.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>End every statement with a semicolon.<\/li>\n\n<li>Use single quotes for text, such as <code>'Apex'<\/code>. Double quotes do not work.<\/li>\n\n<li>Apex is not case sensitive, so <code>Integer<\/code> and <code>integer<\/code> mean the same thing.<\/li>\n\n<li>Comments start with <code>\/\/<\/code> for one line, or sit between <code>\/*<\/code> and <code>*\/<\/code> for many lines.<\/li>\n\n<li>Curly braces group code into blocks, such as the body of a method.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Common Mistakes with Salesforce Apex<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using double quotes for strings. Apex only accepts single quotes.<\/li>\n\n<li>Forgetting the semicolon at the end of a line. The compiler stops at the next line.<\/li>\n\n<li>Writing code before checking clicks. A simple rule may only need a validation rule.<\/li>\n\n<li>Skipping <code>with sharing<\/code>. Without it, your code may show records the user should not see.<\/li>\n\n<li>Testing only in production. Always write and test code in a sandbox or scratch org first.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices for Salesforce Apex<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Give classes clear names that say what they do, like <code>CourseHelper<\/code>.<\/li>\n\n<li>Keep each method small, with one job, so it is easy to test.<\/li>\n\n<li>Add short comments that explain why, not just what.<\/li>\n\n<li>Start every class with <code>with sharing<\/code> unless you have a clear reason not to.<\/li>\n\n<li>Save your project in Git after each working change.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Practice Task<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Add a third method to <code>CourseHelper<\/code> called <code>isPremium<\/code>. It should take a fee and return <code>true<\/code> when the fee is above 8000. Hint: the return type is <code>Boolean<\/code>, and you can write <code>return fee &gt; 8000;<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.apexcode.meta\/apexcode\/apex_intro_what_is_apex.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Apex Developer Guide: What is Apex?<\/a><\/li>\n\n<li><a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/modules\/apex_database\" target=\"_blank\" rel=\"noopener noreferrer\">Trailhead: Apex Basics and Database<\/a><\/li>\n\n<li><a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/trails\/force_com_dev_beginner\" target=\"_blank\" rel=\"noopener noreferrer\">Trailhead: Developer Beginner trail<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Salesforce Apex is a strongly typed, object-oriented language that runs on Salesforce servers.<\/li>\n\n<li>Salesforce compiles your Apex and stores it as metadata in your org.<\/li>\n\n<li>Apex code lives in classes, triggers, test classes and anonymous blocks.<\/li>\n\n<li>Governor limits keep Apex fair on the shared platform.<\/li>\n\n<li>Strings use single quotes, and every statement ends with a semicolon.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we look at the boxes that hold your data. Read <a href=\"https:\/\/swapnilzambare.com\/blog\/apex-data-types-variables-constants\/\">Apex data types, variables and constants<\/a> to learn Integer, String, Decimal, Boolean and more.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Salesforce Apex is the programming language that runs inside Salesforce, and almost every developer job asks for it. In this post, you will learn&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1205,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[8,96],"tags":[98,15,7,97],"swapz_series":[],"class_list":["post-1208","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-salesforce","category-salesforce-developer","tag-apex","tag-beginner","tag-salesforce","tag-salesforce-developer"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Salesforce Apex: What It Is and Your First Class<\/title>\n<meta name=\"description\" content=\"Salesforce Apex explained for beginners: what the language does, how it runs, and how to write, deploy and run your first Apex class.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Salesforce Apex: What It Is and Your First Class\" \/>\n<meta property=\"og:description\" content=\"Salesforce Apex explained for beginners: what the language does, how it runs, and how to write, deploy and run your first Apex class.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/\" \/>\n<meta property=\"og:site_name\" content=\"Swapnil Zambare - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-02T09:30:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Swapnil Zambare\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Swapnil Zambare\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/what-is-salesforce-apex-first-class\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/what-is-salesforce-apex-first-class\\\/\"},\"author\":{\"name\":\"Swapnil Zambare\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/922ac0131aaa7088c78c2cb1700e0c9a\"},\"headline\":\"What is Salesforce Apex? Your First Apex Class\",\"datePublished\":\"2026-09-02T09:30:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/what-is-salesforce-apex-first-class\\\/\"},\"wordCount\":1572,\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/what-is-salesforce-apex-first-class\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/what-is-salesforce-apex-first-class-featured.png\",\"keywords\":[\"Apex\",\"Beginner\",\"Salesforce\",\"Salesforce Developer\"],\"articleSection\":[\"Salesforce\",\"Salesforce Developer\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/what-is-salesforce-apex-first-class\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/what-is-salesforce-apex-first-class\\\/\",\"name\":\"Salesforce Apex: What It Is and Your First Class\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/what-is-salesforce-apex-first-class\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/what-is-salesforce-apex-first-class\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/what-is-salesforce-apex-first-class-featured.png\",\"datePublished\":\"2026-09-02T09:30:00+00:00\",\"description\":\"Salesforce Apex explained for beginners: what the language does, how it runs, and how to write, deploy and run your first Apex class.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/what-is-salesforce-apex-first-class\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/what-is-salesforce-apex-first-class\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/what-is-salesforce-apex-first-class\\\/#primaryimage\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/what-is-salesforce-apex-first-class-featured.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/what-is-salesforce-apex-first-class-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"Salesforce Apex featured image: title card with a first Apex class\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/what-is-salesforce-apex-first-class\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What is Salesforce Apex? Your First Apex Class\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"name\":\"Swapnil Zambare - Blog\",\"description\":\"Salesforce &amp; Tech Guides\",\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\",\"name\":\"Swapnil Zambare - Blog\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"width\":512,\"height\":512,\"caption\":\"Swapnil Zambare - Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/theSwapnilZambare\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/922ac0131aaa7088c78c2cb1700e0c9a\",\"name\":\"Swapnil Zambare\",\"sameAs\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\"],\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/author\\\/swapnil-zambare\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Salesforce Apex: What It Is and Your First Class","description":"Salesforce Apex explained for beginners: what the language does, how it runs, and how to write, deploy and run your first Apex class.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/","og_locale":"en_US","og_type":"article","og_title":"Salesforce Apex: What It Is and Your First Class","og_description":"Salesforce Apex explained for beginners: what the language does, how it runs, and how to write, deploy and run your first Apex class.","og_url":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/","og_site_name":"Swapnil Zambare - Blog","article_published_time":"2026-09-02T09:30:00+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-featured.png","type":"image\/png"}],"author":"Swapnil Zambare","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Swapnil Zambare","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/#article","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/"},"author":{"name":"Swapnil Zambare","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/922ac0131aaa7088c78c2cb1700e0c9a"},"headline":"What is Salesforce Apex? Your First Apex Class","datePublished":"2026-09-02T09:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/"},"wordCount":1572,"publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-featured.png","keywords":["Apex","Beginner","Salesforce","Salesforce Developer"],"articleSection":["Salesforce","Salesforce Developer"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/","url":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/","name":"Salesforce Apex: What It Is and Your First Class","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/#primaryimage"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-featured.png","datePublished":"2026-09-02T09:30:00+00:00","description":"Salesforce Apex explained for beginners: what the language does, how it runs, and how to write, deploy and run your first Apex class.","breadcrumb":{"@id":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/#primaryimage","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-featured.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/10\/what-is-salesforce-apex-first-class-featured.png","width":2400,"height":1260,"caption":"Salesforce Apex featured image: title card with a first Apex class"},{"@type":"BreadcrumbList","@id":"https:\/\/swapnilzambare.com\/blog\/what-is-salesforce-apex-first-class\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/swapnilzambare.com\/blog\/"},{"@type":"ListItem","position":2,"name":"What is Salesforce Apex? Your First Apex Class"}]},{"@type":"WebSite","@id":"https:\/\/swapnilzambare.com\/blog\/#website","url":"https:\/\/swapnilzambare.com\/blog\/","name":"Swapnil Zambare - Blog","description":"Salesforce &amp; Tech Guides","publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/swapnilzambare.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/swapnilzambare.com\/blog\/#organization","name":"Swapnil Zambare - Blog","url":"https:\/\/swapnilzambare.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","width":512,"height":512,"caption":"Swapnil Zambare - Blog"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.linkedin.com\/in\/theSwapnilZambare"]},{"@type":"Person","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/922ac0131aaa7088c78c2cb1700e0c9a","name":"Swapnil Zambare","sameAs":["https:\/\/swapnilzambare.com\/blog"],"url":"https:\/\/swapnilzambare.com\/blog\/author\/swapnil-zambare\/"}]}},"_links":{"self":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/1208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/comments?post=1208"}],"version-history":[{"count":0,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/1208\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media\/1205"}],"wp:attachment":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media?parent=1208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/categories?post=1208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/tags?post=1208"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=1208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}