---
schema_version: "1"
id: c04429cc44bab062ea8ea93d383d7b111e1f09580415697c72190c652b499efe
title: Expressions and Operators
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/langCon_apex_expressions.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 60e354d03aa86bf92ba9c5cd3b6d504f760c16101c6c03750e695bf774a338a7
description: An expression is a construct made up of variables, operators, and method invocations that evaluates to a single value.
---
# Expressions and Operators

An expression is a construct made up of variables, operators, and method invocations that evaluates to a single value.

- **[Expressions](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions_understanding.htm)**  
    An expression is a construct made up of variables, operators, and method invocations that evaluates to a single value.
- **[Expression Operators](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions_operators_understanding.htm)**  
    Expressions can be joined to one another with operators to create compound expressions.
- **[Safe Navigation Operator](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SafeNavigationOperator.htm)**  
    Use the safe navigation operator (?.) to replace explicit, sequential checks for null references. This operator short-circuits expressions that attempt to operate on a null value and returns null instead of throwing a NullPointerException.
- **[Null Coalescing Operator](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_NullCoalescingOperator.htm)**  
    The ?? operator returns its right-hand side operand when its left-hand side operand is null. Similar to the safe navigation operator (?.), the null coalescing operator (??) replaces verbose and explicit checks for null references in code.
- **[Operator Precedence](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions_operators_precedence.htm)**  
    Operators are interpreted in order, according to rules.
- **[Comments](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions_comments.htm)**  
    Both single and multiline comments are supported in Apex code.

- [← Previous](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_constants.htm "Constants")
- [Next →](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_assignment_statements.htm "Assignment Statements")

#### See Also

- [Expanding sObject and List Expressions](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions_extending_SObjects.htm)