---
schema_version: "1"
id: 01c419850ce1b51ea8292f3bc54d5f4c8bfe819924128f8b7816a47ab74edfa5
title: Expression Operators
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/langCon_apex_expressions_operators_understanding.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions_operators_understanding.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8e43d9d3f828c772aeff9ece7bfb2bd36e9da76815638145664b250e612f3390
description: Expressions can be joined to one another with operators to create compound expressions.
---
# Expression Operators

Expressions can be joined to one another with operators to create compound expressions.

Apex supports the following operators:

<table class="featureTable sort_table" summary="">



        <thead class="thead sorted" align="left">
          <tr>
            <th class="featureTableHeader vertical-align-top " id="d153770e48">Operator</th>

            <th class="featureTableHeader vertical-align-top " id="d153770e51">Syntax</th>

            <th class="featureTableHeader vertical-align-top " id="d153770e54">Description</th>

          </tr>

        </thead>

        <tbody class="tbody">
          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x = y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Assignment operator</strong> (Right associative). Assigns the value of
              <samp class="codeph apex_code">y</samp> to the L-value <samp class="codeph apex_code">x</samp>. The data type of <samp class="codeph apex_code">x</samp> must match the data type of
              <samp class="codeph apex_code">y</samp> and can’t be <samp class="codeph apex_code"><span class="keyword">null</span></samp>.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">+=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x += y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Addition assignment operator</strong> (Right associative). Adds the
              value of <samp class="codeph apex_code">y</samp> to the original
              value of <samp class="codeph apex_code">x</samp> and then reassigns
              the new value to <samp class="codeph apex_code">x</samp>. See <samp class="codeph apex_code">+</samp> for additional information.
              <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> can’t be <samp class="codeph apex_code"><span class="keyword">null</span></samp>.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">*=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x *= y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Multiplication assignment operator</strong> (Right associative).
              Multiplies the value of <samp class="codeph apex_code">y</samp> with
              the original value of <samp class="codeph apex_code">x</samp> and
              then reassigns the new value to <samp class="codeph apex_code">x</samp>. <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> can’t be <samp class="codeph apex_code"><span class="keyword">null</span></samp>.<p class="p"><samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> must be Integers or Doubles
                or a combination. </p>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">-=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x -= y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Subtraction assignment operator</strong> (Right associative). Subtracts
              the value of <samp class="codeph apex_code">y</samp> from the
              original value of <samp class="codeph apex_code">x</samp> and then
              reassigns the new value to <samp class="codeph apex_code">x</samp>.
              <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> can’t be <samp class="codeph apex_code"><span class="keyword">null</span></samp>.<p class="p"><samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> must be Integers or Doubles
                or a combination.</p>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">/=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x /= y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Division assignment operator</strong> (Right associative). Divides the
              original value of <samp class="codeph apex_code">x</samp> with the
              value of <samp class="codeph apex_code">y</samp> and then reassigns
              the new value to <samp class="codeph apex_code">x</samp>. <p class="p"><samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> must be Integers or Doubles
                or a combination.</p>
              <p class="p"><samp class="codeph apex_code">x</samp>
                and <samp class="codeph apex_code">y</samp> can’t be <samp class="codeph apex_code"><span class="keyword">null</span></samp>.</p>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">|=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x |= y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">OR assignment operator</strong> (Right associative). If <samp class="codeph apex_code">x</samp>, a Boolean, and <samp class="codeph apex_code">y</samp>, a Boolean, are both false, then
              <samp class="codeph apex_code">x</samp> remains false. Otherwise
              <samp class="codeph apex_code">x</samp> is assigned the value of
              true. <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> can’t be <samp class="codeph apex_code"><span class="keyword">null</span></samp>.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&amp;=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &amp;= y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">AND assignment operator</strong> (Right associative). If <samp class="codeph apex_code">x</samp>, a Boolean, and <samp class="codeph apex_code">y</samp>, a Boolean, are both true, then
              <samp class="codeph apex_code">x</samp> remains true. Otherwise
              <samp class="codeph apex_code">x</samp> is assigned the value of
              false. <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> can’t be <samp class="codeph apex_code"><span class="keyword">null</span></samp>.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&lt;&lt;=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &lt;&lt;= y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Bitwise shift left assignment operator</strong>. Shifts each bit in
              <samp class="codeph apex_code">x</samp> to the left by <samp class="codeph apex_code">y</samp> bits so that the high-order bits
              are lost and the new right bits are set to 0. This value is then
              reassigned to <samp class="codeph apex_code">x</samp>.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&gt;&gt;=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &gt;&gt;= y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Bitwise shift right signed assignment operator</strong>. Shifts each
              bit in <samp class="codeph apex_code">x</samp> to the right by
              <samp class="codeph apex_code">y</samp> bits so that the
              low-order bits are lost and the new left bits are set to 0 for positive
              values of <samp class="codeph apex_code">y</samp> and 1 for negative
              values of <samp class="codeph apex_code">y</samp>. This value is then
              reassigned to <samp class="codeph apex_code">x</samp>.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&gt;&gt;&gt;=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &gt;&gt;&gt;= y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Bitwise shift right unsigned assignment operator</strong>. Shifts each
              bit in <samp class="codeph apex_code">x</samp> to the right by
              <samp class="codeph apex_code">y</samp> bits so that the
              low-order bits are lost and the new left bits are set to 0 for all
              values of <samp class="codeph apex_code">y</samp>. This value is then
              reassigned to <samp class="codeph apex_code">x</samp>.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">? :</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x ? y : z</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Ternary operator</strong> (Right associative). This operator acts as a
              short-hand for if-then-else statements. If <samp class="codeph apex_code">x</samp>, a Boolean, is true, <samp class="codeph apex_code">y</samp> is the result. Otherwise <samp class="codeph apex_code">z</samp> is the result. <p class="p"><samp class="codeph apex_code">x</samp> can’t be <samp class="codeph apex_code"><span class="keyword">null</span></samp>.</p>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&amp;&amp;</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &amp;&amp; y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">AND logical operator</strong> (Left associative). If <samp class="codeph apex_code">x</samp>, a Boolean, and <samp class="codeph apex_code">y</samp>, a Boolean, are both true, then
              the expression evaluates to true. Otherwise the expression evaluates to
              false. <ul class="ul bulletList">
                <li class="li">
                  <samp class="codeph apex_code">&amp;&amp;</samp> has
                  precedence over <samp class="codeph apex_code">||</samp>
                </li>

                <li class="li">This operator exhibits short-circuiting behavior, which means
                  <samp class="codeph apex_code">y</samp> is evaluated only
                  if <samp class="codeph apex_code">x</samp> is true.
                </li>

                <li class="li">
                  <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> can’t be <samp class="codeph apex_code"><span class="keyword">null</span></samp>.
                </li>

              </ul>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">||</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x || y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">OR logical operator</strong> (Left associative). If <samp class="codeph apex_code">x</samp>, a Boolean, and <samp class="codeph apex_code">y</samp>, a Boolean, are both false, then
              the expression evaluates to false. Otherwise the expression evaluates to
              true. <ul class="ul bulletList">
                <li class="li">
                  <samp class="codeph apex_code">&amp;&amp;</samp> has
                  precedence over <samp class="codeph apex_code">||</samp>
                </li>

                <li class="li">This operator exhibits short-circuiting behavior, which means
                  <samp class="codeph apex_code">y</samp> is evaluated only
                  if <samp class="codeph apex_code">x</samp> is false.
                </li>

                <li class="li"><span class="ph" id="notNull"><a name="notNull"><!-- --></a><samp class="codeph apex_code">x</samp> and
                    <samp class="codeph apex_code">y</samp> can’t be
                    <samp class="codeph apex_code"><span class="keyword">null</span></samp>.</span></li>

              </ul>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code" id="equals_operator"><a name="equals_operator"><!-- --></a>==</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x == y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Equality operator</strong>. If the value of <samp class="codeph apex_code">x</samp> equals the value of <samp class="codeph apex_code">y</samp>, the expression evaluates to
              true. Otherwise the expression evaluates to false. <a name="ul_s2b_14z_wjc"><!-- --></a>
              <ul class="ul bulletList" id="ul_s2b_14z_wjc">
                <li class="li">Unlike Java, <samp class="codeph apex_code">==</samp> in Apex
                  compares object value equality not reference equality, except
                  for user-defined types. Therefore:<a name="ul_t2b_14z_wjc"><!-- --></a>
                  <ul class="ul bulletList" id="ul_t2b_14z_wjc">
                    <li class="li">String comparison using <samp class="codeph apex_code">==</samp> is case-insensitive and is performed
                      according to the locale of the context user</li>

                    <li class="li">ID comparison using <samp class="codeph apex_code">==</samp> is case-sensitive and doesn’t
                      distinguish between 15-character and 18-character
                      formats</li>

                    <li class="li">User-defined types are compared by reference, which
                      means that two objects are equal only if they reference
                      the same location in memory. You can override this
                      default comparison behavior by providing <samp class="codeph apex_code">equals</samp> and <samp class="codeph apex_code">hashCode</samp> methods in
                      your class to compare object values instead.</li>

                  </ul>
                </li>

                <li class="li">For sObjects and sObject arrays, <samp class="codeph apex_code">==</samp> performs a deep check of all sObject field
                  values before returning its result. Likewise for collections and
                  built-in Apex objects. </li>

                <li class="li">For records, every field must have the same value for <samp class="codeph apex_code">==</samp> to evaluate to true. </li>

                <li class="li">
                  <samp class="codeph apex_code">x</samp> or <samp class="codeph apex_code">y</samp> can be the literal
                  <samp class="codeph apex_code"><span class="keyword">null</span></samp>.
                </li>

                <li class="li">The comparison of any two values can never result in <samp class="codeph apex_code"><span class="keyword">null</span></samp>.</li>

                <li class="li">SOQL and SOSL use <samp class="codeph apex_code">=</samp> for
                  their equality operator and not <samp class="codeph apex_code">==</samp>. Although Apex and SOQL and SOSL are strongly
                  linked, this unfortunate syntax discrepancy exists because most
                  modern languages use <samp class="codeph apex_code">=</samp>
                  for assignment and <samp class="codeph apex_code">==</samp>
                  for equality. The designers of Apex deemed it more valuable to
                  maintain this paradigm than to force developers to learn a new
                  assignment operator. As a result, Apex developers must use
                  <samp class="codeph apex_code">==</samp> for equality
                  tests in the main body of the Apex code, and <samp class="codeph apex_code">=</samp> for equality in SOQL and
                  SOSL queries.
                </li>

              </ul>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">===</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x === y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Exact equality operator</strong>. If <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> reference
              the exact same location in memory the expression evaluates to true.
              Otherwise the expression evaluates to false.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&lt;</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &lt; y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Less than operator</strong>. If <samp class="codeph apex_code">x</samp> is less than <samp class="codeph apex_code">y</samp>,
              the expression evaluates to true. Otherwise the expression evaluates to
              false. <a name="ul_pvn_14z_wjc"><!-- --></a>
              <ul class="ul bulletList" id="ul_pvn_14z_wjc">
                <li class="li">Unlike other database stored procedures, Apex doesn’t support
                  tri-state Boolean logic and the <span class="ph" id="compare"><a name="compare"><!-- --></a>comparison of
                    any two values can never result in <samp class="codeph apex_code"><span class="keyword">null</span></samp>.</span>
                </li>

                <li class="li">If <samp class="codeph apex_code">x</samp> or <samp class="codeph apex_code">y</samp> equal <samp class="codeph apex_code"><span class="keyword">null</span></samp> and are Integers,
                  Doubles, Dates, or Datetimes, the expression is false.</li>

                <li class="li"><span class="ph" id="non_null"><a name="non_null"><!-- --></a>A non-<samp class="codeph apex_code"><span class="keyword">null</span></samp> String or ID value is always greater than
                    a <samp class="codeph apex_code"><span class="keyword">null</span></samp>
                    value.</span></li>

                <li class="li"><span class="ph" id="ids"><a name="ids"><!-- --></a>If <samp class="codeph apex_code">x</samp> and
                    <samp class="codeph apex_code">y</samp> are IDs, they
                    must reference the same type of object. Otherwise a runtime
                    error results.</span></li>

                <li class="li"><span class="ph" id="string_id_compare"><a name="string_id_compare"><!-- --></a>If <samp class="codeph apex_code">x</samp> or <samp class="codeph apex_code">y</samp> is an ID and the other value is a String,
                    the String value is validated and treated as an
                    ID.</span></li>

                <li class="li">
                  <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> can’t be Booleans.
                </li>

                <li class="li">The comparison of two strings is performed according to the
                  locale of the context user and is case-insensitive.</li>

              </ul>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&gt;</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &gt; y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Greater than operator</strong>. If <samp class="codeph apex_code">x</samp> is greater than <samp class="codeph apex_code">y</samp>, the expression evaluates to true. Otherwise the
              expression evaluates to false. <a name="ul_vk1_b4z_wjc"><!-- --></a>
              <ul class="ul bulletList" id="ul_vk1_b4z_wjc">
                <li class="li">The comparison of any two values can never result in <samp class="codeph apex_code"><span class="keyword">null</span></samp>.</li>

                <li class="li">If <samp class="codeph apex_code">x</samp> or <samp class="codeph apex_code">y</samp> equal <samp class="codeph apex_code"><span class="keyword">null</span></samp> and are Integers,
                  Doubles, Dates, or Datetimes, the expression is false.</li>

                <li class="li">A non-<samp class="codeph apex_code"><span class="keyword">null</span></samp> String or ID
                  value is always greater than a <samp class="codeph apex_code"><span class="keyword">null</span></samp> value.</li>

                <li class="li">If <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> are IDs, they must
                  reference the same type of object. Otherwise a runtime error
                  results.</li>

                <li class="li">If <samp class="codeph apex_code">x</samp> or <samp class="codeph apex_code">y</samp> is an ID and the other
                  value is a String, the String value is validated and treated as
                  an ID.</li>

                <li class="li">
                  <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> can’t be Booleans.
                </li>

                <li class="li">The comparison of two strings is performed according to the
                  locale of the context user and is case-insensitive.</li>

              </ul>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&lt;=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &lt;= y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Less than or equal to operator</strong>. If <samp class="codeph apex_code">x</samp> is less than or equal to <samp class="codeph apex_code">y</samp>, the expression evaluates to
              true. Otherwise the expression evaluates to false. <a name="ul_bwj_b4z_wjc"><!-- --></a>
              <ul class="ul bulletList" id="ul_bwj_b4z_wjc">
                <li class="li">The comparison of any two values can never result in <samp class="codeph apex_code"><span class="keyword">null</span></samp>.</li>

                <li class="li">If <samp class="codeph apex_code">x</samp> or <samp class="codeph apex_code">y</samp> equal <samp class="codeph apex_code"><span class="keyword">null</span></samp> and are Integers,
                  Doubles, Dates, or Datetimes, the expression is false.</li>

                <li class="li">A non-<samp class="codeph apex_code"><span class="keyword">null</span></samp> String or ID
                  value is always greater than a <samp class="codeph apex_code"><span class="keyword">null</span></samp> value.</li>

                <li class="li">If <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> are IDs, they must
                  reference the same type of object. Otherwise a runtime error
                  results.</li>

                <li class="li">If <samp class="codeph apex_code">x</samp> or <samp class="codeph apex_code">y</samp> is an ID and the other
                  value is a String, the String value is validated and treated as
                  an ID.</li>

                <li class="li">
                  <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> can’t be Booleans.
                </li>

                <li class="li">The comparison of two strings is performed according to the
                  locale of the context user and is case-insensitive.</li>

              </ul>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&gt;=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &gt;= y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Greater than or equal to operator</strong>. If <samp class="codeph apex_code">x</samp> is greater than or equal to
              <samp class="codeph apex_code">y</samp>, the expression evaluates
              to true. Otherwise the expression evaluates to false. <a name="ul_s25_b4z_wjc"><!-- --></a>
              <ul class="ul bulletList" id="ul_s25_b4z_wjc">
                <li class="li">The comparison of any two values can never result in <samp class="codeph apex_code"><span class="keyword">null</span></samp>.</li>

                <li class="li">If <samp class="codeph apex_code">x</samp> or <samp class="codeph apex_code">y</samp> equal <samp class="codeph apex_code"><span class="keyword">null</span></samp> and are Integers,
                  Doubles, Dates, or Datetimes, the expression is false.</li>

                <li class="li">A non-<samp class="codeph apex_code"><span class="keyword">null</span></samp> String or ID
                  value is always greater than a <samp class="codeph apex_code"><span class="keyword">null</span></samp> value.</li>

                <li class="li">If <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> are IDs, they must
                  reference the same type of object. Otherwise a runtime error
                  results.</li>

                <li class="li">If <samp class="codeph apex_code">x</samp> or <samp class="codeph apex_code">y</samp> is an ID and the other
                  value is a String, the String value is validated and treated as
                  an ID.</li>

                <li class="li">
                  <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> can’t be Booleans.
                </li>

                <li class="li">The comparison of two strings is performed according to the
                  locale of the context user and is case-insensitive.</li>

              </ul>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">!=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x != y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Inequality operator</strong>. If the value of <samp class="codeph apex_code">x</samp> doesn’t equal the value of
              <samp class="codeph apex_code">y</samp>, the expression evaluates
              to true. Otherwise the expression evaluates to false. <a name="ul_cp2_c4z_wjc"><!-- --></a>
              <ul class="ul bulletList" id="ul_cp2_c4z_wjc">
                <li class="li">String comparison using <samp class="codeph apex_code">!=</samp> is case-insensitive</li>

                <li class="li">Unlike Java, <samp class="codeph apex_code">!=</samp> in Apex
                  compares object value equality not reference equality, except
                  for user-defined types.</li>

                <li class="li">For sObjects and sObject arrays, <samp class="codeph apex_code">!=</samp> performs a deep check of all sObject field
                  values before returning its result.</li>

                <li class="li">For records, <samp class="codeph apex_code">!=</samp>
                  evaluates to true if the records have different values for any
                  field.</li>

                <li class="li">User-defined types are compared by reference, which means that
                  two objects are different only if they reference different
                  locations in memory. You can override this default comparison
                  behavior by providing <samp class="codeph apex_code">equals</samp> and <samp class="codeph apex_code">hashCode</samp> methods in your class to compare object
                  values instead.</li>

                <li class="li">
                  <samp class="codeph apex_code">x</samp> or <samp class="codeph apex_code">y</samp>
                  <em class="ph i">can</em> be the literal <samp class="codeph apex_code"><span class="keyword">null</span></samp>.
                </li>

                <li class="li">The comparison of any two values can never result in <samp class="codeph apex_code"><span class="keyword">null</span></samp>.</li>

              </ul>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">!==</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x !== y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Exact inequality operator</strong>. If <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> don’t
              reference the exact same location in memory, the expression evaluates to
              true. Otherwise the expression evaluates to false.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">+</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x + y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Addition operator</strong>. Adds the value of <samp class="codeph apex_code">x</samp> to the value of <samp class="codeph apex_code">y</samp> according to the following rules: <ul class="ul bulletList">
                <li class="li">If <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> are Integers or Doubles,
                  the operator adds the value of <samp class="codeph apex_code">x</samp> to the value of <samp class="codeph apex_code">y</samp>. If a Double is used, the result is a
                  Double.</li>

                <li class="li">If <samp class="codeph apex_code">x</samp> is a Date and
                  <samp class="codeph apex_code">y</samp> is an Integer,
                  returns a new Date that is incremented by the specified number
                  of days.
                </li>

                <li class="li">If <samp class="codeph apex_code">x</samp> is a Datetime and
                  <samp class="codeph apex_code">y</samp> is an Integer or
                  Double, returns a new Date that is incremented by the specified
                  number of days, with the fractional portion corresponding to a
                  portion of a day.
                </li>

                <li class="li">If <samp class="codeph apex_code">x</samp> is a String and
                  <samp class="codeph apex_code">y</samp> is a String or
                  any other type of non-<samp class="codeph apex_code"><span class="keyword">null</span></samp> argument, concatenates <samp class="codeph apex_code">y</samp> to the end of <samp class="codeph apex_code">x</samp>.
                </li>

              </ul>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">-</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x - y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Subtraction operator</strong>. Subtracts the value of <samp class="codeph apex_code">y</samp> from the value of <samp class="codeph apex_code">x</samp> according to the following rules:<ul class="ul bulletList">
                <li class="li">If <samp class="codeph apex_code">x</samp> and <samp class="codeph apex_code">y</samp> are Integers or Doubles,
                  the operator subtracts the value of <samp class="codeph apex_code">y</samp> from the value of <samp class="codeph apex_code">x</samp>. If a Double is used, the
                  result is a Double.</li>

                <li class="li">If <samp class="codeph apex_code">x</samp> is a Date and
                  <samp class="codeph apex_code">y</samp> is an Integer,
                  returns a new Date that is decremented by the specified number
                  of days.
                </li>

                <li class="li">If <samp class="codeph apex_code">x</samp> is a Datetime and
                  <samp class="codeph apex_code">y</samp> is an Integer or
                  Double, returns a new Date that is decremented by the specified
                  number of days, with the fractional portion corresponding to a
                  portion of a day.
                </li>

              </ul>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">*</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x * y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Multiplication operator</strong>. Multiplies <samp class="codeph apex_code">x</samp>, an Integer or Double, with
              <samp class="codeph apex_code">y</samp>, another Integer or
              Double. If a double is used, the result is a Double.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">/</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x / y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Division operator</strong>. Divides <samp class="codeph apex_code">x</samp>, an Integer or Double, by <samp class="codeph apex_code">y</samp>, another Integer or Double. If a
              double is used, the result is a Double.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">!</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">!x</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Logical complement operator</strong>. Inverts the value of a Boolean so
              that true becomes false and false becomes true.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">-</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">-x</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Unary negation operator</strong>. Multiplies the value of <samp class="codeph apex_code">x</samp>, an Integer or Double, by -1. The
              positive equivalent <samp class="codeph apex_code">+</samp> is also
              syntactically valid but doesn’t have a mathematical effect.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">++</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax">
              <samp class="codeph apex_code">x++</samp>
              <p class="p"><samp class="codeph apex_code">++x</samp></p>
            </td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Increment operator</strong>. Adds 1 to the value of <samp class="codeph apex_code">x</samp>, a variable of a numeric type. If
              prefixed (<samp class="codeph apex_code">++x</samp>), the expression
              evaluates to the value of x after the increment. If postfixed (<samp class="codeph apex_code">x++</samp>), the expression evaluates to
              the value of x before the increment.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">--</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax">
              <samp class="codeph apex_code">x--</samp>
              <p class="p"><samp class="codeph apex_code">--x</samp></p>
            </td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Decrement operator</strong>. Subtracts 1 from the value of <samp class="codeph apex_code">x</samp>, a variable of a numeric type. If
              prefixed (<samp class="codeph apex_code">--x</samp>), the expression
              evaluates to the value of x after the decrement. If postfixed (<samp class="codeph apex_code">x--</samp>), the expression evaluates to
              the value of x before the decrement.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&amp;</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &amp; y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Bitwise AND operator</strong>. ANDs each bit in <samp class="codeph apex_code">x</samp> with the corresponding bit in
              <samp class="codeph apex_code">y</samp> so that the result bit is
              set to 1 if both of the bits are set to 1.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">|</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x | y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Bitwise OR operator</strong>. ORs each bit in <samp class="codeph apex_code">x</samp> with the corresponding bit in
              <samp class="codeph apex_code">y</samp> so that the result bit is
              set to 1 if at least one of the bits is set to 1.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">^</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x ^ y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Bitwise exclusive OR operator</strong>. Exclusive ORs each bit in
              <samp class="codeph apex_code">x</samp> with the corresponding
              bit in <samp class="codeph apex_code">y</samp> so that the result bit
              is set to 1 if exactly one of the bits is set to 1 and the other bit is
              set to 0.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">^=</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x ^= y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Bitwise exclusive OR operator</strong>. Exclusive ORs each bit in
              <samp class="codeph apex_code">x</samp> with the corresponding
              bit in <samp class="codeph apex_code">y</samp> so that the result bit
              is set to 1 if exactly one of the bits is set to 1 and the other bit is
              set to 0. Assigns the result of the exclusive OR operation to <samp class="codeph apex_code">x</samp>.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&lt;&lt;</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &lt;&lt; y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Bitwise shift left operator</strong>. Shifts each bit in <samp class="codeph apex_code">x</samp> to the left by <samp class="codeph apex_code">y</samp> bits so that the high-order bits
              are lost and the new right bits are set to 0.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&gt;&gt;</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &gt;&gt; y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Bitwise shift right signed operator</strong>. Shifts each bit in
              <samp class="codeph apex_code">x</samp> to the right by <samp class="codeph apex_code">y</samp> bits so that the low-order bits
              are lost and the new left bits are set to 0 for positive values of
              <samp class="codeph apex_code">y</samp> and 1 for negative values
              of <samp class="codeph apex_code">y</samp>.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">&gt;&gt;&gt;</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">x &gt;&gt;&gt; y</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Bitwise shift right unsigned operator</strong>. Shifts each bit in
              <samp class="codeph apex_code">x</samp> to the right by <samp class="codeph apex_code">y</samp> bits so that the low-order bits
              are lost and the new left bits are set to 0 for all values of <samp class="codeph apex_code">y</samp>.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">~</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph ">~x</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Bitwise Not or Complement operator</strong>. Toggles each binary digit
              of <samp class="codeph apex_code">x</samp>, converting 0 to 1 and 1
              to 0. Boolean values are converted from <samp class="codeph ">True</samp> to <samp class="codeph ">False</samp> and vice
              versa.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">()</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax"><samp class="codeph apex_code">(x)</samp></td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Parentheses</strong>. Elevates the precedence of an expression <samp class="codeph apex_code">x</samp> so that it’s evaluated first in
              a compound expression.
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d153770e48" data-title="Operator"><samp class="codeph apex_code">?.</samp></td>

            <td class="entry" headers="d153770e51" data-title="Syntax">x?.y</td>

            <td class="entry" headers="d153770e54" data-title="Description">
              <strong class="ph b">Safe navigation operator</strong>. Short-circuits expressions that
              attempt to operate on a null value, and returns null instead of throwing
              a NullPointerException. If the left-hand side of the chain expression
              evaluates to null, the right-hand side of the chain expression isn’t
              evaluated.
            </td>

          </tr>

        </tbody>

      </table>