{"id":3619,"date":"2023-11-20T21:33:30","date_gmt":"2023-11-20T13:33:30","guid":{"rendered":"http:\/\/www.ponybai.com\/?p=3619"},"modified":"2023-11-20T21:40:30","modified_gmt":"2023-11-20T13:40:30","slug":"%e8%a1%a8%e8%be%be%e5%bc%8f%e5%92%8c%e8%bf%90%e7%ae%97%e7%ac%a6","status":"publish","type":"post","link":"http:\/\/www.ponybai.com\/?p=3619","title":{"rendered":"Apex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26"},"content":{"rendered":"\r\n<p>\u8868\u8fbe\u5f0f\u662f\u7531\u53d8\u91cf\u3001\u8fd0\u7b97\u7b26\u548c\u65b9\u6cd5\u8c03\u7528\u7ec4\u6210\u7684\u6784\u9020\uff0c\u8fd9\u4e9b\u53d8\u91cf\u3001\u8fd0\u7b97\u7b26\u548c\u65b9\u6cd5\u8c03\u7528 \u8ba1\u7b97\u7ed3\u679c\u4e3a\u5355\u4e2a\u503c\u3002<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>\u8868\u8fbe\u5f0f<br \/>\u662f\u7531\u53d8\u91cf\u3001\u8fd0\u7b97\u7b26\u548c\u65b9\u6cd5\u8c03\u7528\u7ec4\u6210\u7684\u6784\u9020\uff0c\u5176\u8ba1\u7b97\u7ed3\u679c\u4e3a\u5355\u4e2a\u503c\u3002<\/li>\r\n\r\n\r\n\r\n<li>\u8868\u8fbe\u5f0f\u8fd0\u7b97\u7b26 \u8868\u8fbe\u5f0f\u53ef\u4ee5\u4f7f\u7528<strong>\u8fd0\u7b97\u7b26<\/strong><br \/>\u76f8\u4e92\u8fde\u63a5\u4ee5\u521b\u5efa\u590d\u5408\u8868\u8fbe\u5f0f\u3002<\/li>\r\n\r\n\r\n\r\n<li>\u5b89\u5168\u5bfc\u822a\u8fd0\u7b97\u7b26 \u4f7f\u7528<strong>\u5b89\u5168\u5bfc\u822a\u8fd0\u7b97\u7b26<\/strong><br \/>\uff08\uff09 \u66ff\u6362\u5bf9 null \u5f15\u7528\u7684\u663e\u5f0f\u987a\u5e8f\u68c0\u67e5\u3002\u6b64\u8fd0\u7b97\u7b26\u4f7f\u5c1d\u8bd5\u5bf9 null \u503c\u8fdb\u884c\u64cd\u4f5c\u7684\u8868\u8fbe\u5f0f\u77ed\u8def\uff0c\u5e76\u8fd4\u56de null \u800c\u4e0d\u662f\u5f15\u53d1 NullPointerException\u3002<samp>?.<\/samp><\/li>\r\n\r\n\r\n\r\n<li>\u8fd0\u7b97\u7b26<strong>\u4f18\u5148\u7ea7<\/strong><br \/>\u8fd0\u7b97\u7b26\u6839\u636e\u89c4\u5219\u6309\u987a\u5e8f\u8fdb\u884c\u89e3\u91ca\u3002<\/li>\r\n\r\n\r\n\r\n<li><strong>\u6ce8\u91ca<\/strong><br \/>Apex \u4ee3\u7801\u652f\u6301\u5355\u884c\u548c\u591a\u884c\u6ce8\u91ca\u3002<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h1 class=\"wp-block-heading\">\u8868\u8fbe\u5f0f<\/h1>\r\n\r\n\r\n\r\n<p>\u8868\u8fbe\u5f0f\u662f\u7531\u53d8\u91cf\u3001\u8fd0\u7b97\u7b26\u548c\u65b9\u6cd5\u8c03\u7528\u7ec4\u6210\u7684\u6784\u9020 \u8ba1\u7b97\u7ed3\u679c\u4e3a\u5355\u4e2a\u503c\u3002<\/p>\r\n\r\n\r\n\r\n<p>\u5728 Apex \u4e2d\uff0c\u8868\u8fbe\u5f0f\u59cb\u7ec8\u662f\u4ee5\u4e0b\u7c7b\u578b\u4e4b\u4e00\uff1a<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>\u6587\u5b57\u8868\u8fbe\u5f0f\u3002\u4f8b\u5982\uff1a<code>1 + 1<\/code><\/li>\r\n\r\n\r\n\r\n<li>\u65b0\u7684 sObject\u3001Apex \u5bf9\u8c61\u3001\u5217\u8868\u3001\u96c6\u6216\u6620\u5c04\u3002\u4e3a \u4f8b\uff1a<code>new Account(&lt;field_initializers&gt;) new Integer[&lt;n&gt;] new Account[]{&lt;elements&gt;} new List&lt;Account&gt;() new Set&lt;String&gt;{} new Map&lt;String, Integer&gt;() new myRenamingClass(string oldName, string newName)<\/code><\/li>\r\n\r\n\r\n\r\n<li>\u4efb\u4f55\u53ef\u4ee5\u5145\u5f53\u8d4b\u503c\u8fd0\u7b97\u7b26\u5de6\u4fa7\u7684\u503c\uff08L \u503c\uff09\uff0c \u5305\u62ec\u53d8\u91cf\u3001\u4e00\u7ef4\u5217\u8868\u4f4d\u7f6e\u4ee5\u53ca\u5927\u591a\u6570 sObject \u6216 Apex \u5bf9\u8c61 \u5b57\u6bb5\u5f15\u7528\u3002\u4f8b\u5982\uff1a<code>Integer i myList[3] myContact.name myRenamingClass.oldName<\/code><\/li>\r\n\r\n\r\n\r\n<li>\u4efb\u4f55\u4e0d\u662f L \u503c\u7684 sObject \u5b57\u6bb5\u5f15\u7528\uff0c\u5305\u62ec\uff1a\r\n<ul class=\"wp-block-list\">\r\n<li>\u5217\u8868\u4e2d sObject \u7684 ID\uff08\u8bf7\u53c2\u9605\u5217\u8868)<\/li>\r\n\r\n\r\n\r\n<li>\u4e0e sObject \u5173\u8054\u7684\u4e00\u7ec4\u5b50\u8bb0\u5f55\uff08\u4f8b\u5982\uff0c\u4e00\u7ec4 \u4e0e\u7279\u5b9a\u5e10\u6237\u5173\u8054\u7684\u8054\u7cfb\u4eba\uff09\u3002\u8fd9\u79cd\u7c7b\u578b\u7684\u8868\u8fbe\u5f0f \u751f\u6210\u67e5\u8be2\u7ed3\u679c\uff0c\u4e0e SOQL \u548c SOSL \u67e5\u8be2\u975e\u5e38\u76f8\u4f3c\u3002<\/li>\r\n<\/ul>\r\n<\/li>\r\n\r\n\r\n\r\n<li>\u7528\u65b9\u62ec\u53f7\u62ec\u8d77\u6765\u7684 SOQL \u6216 SOSL \u67e5\u8be2\uff0c\u5141\u8bb8\u52a8\u6001 \u5728 Apex \u4e2d\u8bc4\u4f30\u3002\u4e3a \u4f8b\uff1a<code>Account[] aa = [SELECT Id, Name FROM Account WHERE Name ='Acme']; Integer i = [SELECT COUNT() FROM Contact WHERE LastName ='Weissman']; List&lt;List&lt;SObject&gt;&gt; searchList = [FIND 'map*' IN ALL FIELDS RETURNING Account (Id, Name), Contact, Opportunity, Lead];<\/code>\u4e3a \u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u00a0SOQL \u548c SOSL \u67e5\u8be2\u3002<\/li>\r\n\r\n\r\n\r\n<li>\u9759\u6001\u65b9\u6cd5\u6216\u5b9e\u4f8b\u65b9\u6cd5\u8c03\u7528\u3002\u4e3a \u4f8b\uff1a<code>System.assert(true) myRenamingClass.replaceNames() changePoint(new Point(x, y));<\/code><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h1 class=\"wp-block-heading\">\u8868\u8fbe\u5f0f\u8fd0\u7b97\u7b26<\/h1>\r\n\r\n\r\n\r\n<p>\u8868\u8fbe\u5f0f\u53ef\u4ee5\u4f7f\u7528\u8fd0\u7b97\u7b26\u76f8\u4e92\u8fde\u63a5\u4ee5\u521b\u5efa\u590d\u5408 \u8868\u8fbe \u5f0f\u3002<\/p>\r\n\r\n\r\n\r\n<p>Apex \u652f\u6301\u4ee5\u4e0b\u8fd0\u7b97\u7b26\uff1a<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-table\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<th>\u7b97\u5b50<\/th>\r\n<th>\u8bed\u6cd5<\/th>\r\n<th>\u63cf\u8ff0<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td><samp>=<\/samp><\/td>\r\n<td><samp>x = y<\/samp><\/td>\r\n<td><strong>\u8d4b\u503c\u8fd0\u7b97\u7b26<\/strong>\uff08\u53f3\u5173\u8054\uff09\u3002\u5c06 \u7684\u503c\u5206\u914d\u7ed9 L \u503c\u3002\u7684\u6570\u636e\u7c7b\u578b\u5fc5\u987b\u4e0e \u7684\u6570\u636e\u7c7b\u578b\u5339\u914d\uff0c\u5e76\u4e14\u4e0d\u80fd\u662f \u3002<samp>y<\/samp><samp>x<\/samp><samp>x<\/samp><samp>y<\/samp><samp>null<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>+=<\/samp><\/td>\r\n<td><samp>x += y<\/samp><\/td>\r\n<td><strong>\u52a0\u6cd5\u8d4b\u503c\u8fd0\u7b97\u7b26<\/strong>\uff08\u53f3\u5173\u8054\uff09\u3002\u6dfb\u52a0 \u5230\u539f\u59cb\u503c\u7684\u503c \u7684\u503c\uff0c\u7136\u540e\u91cd\u65b0\u8d4b\u503c \u7684\u65b0\u503c\u3002\u6709\u5173\u5176\u4ed6\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u3002 \u800c\u4e14\u4e0d\u53ef\u80fd.<samp>y<\/samp><samp>x<\/samp><samp>x<\/samp><samp>+<\/samp><samp>x<\/samp><samp>y<\/samp><samp>null<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>*=<\/samp><\/td>\r\n<td><samp>x *= y<\/samp><\/td>\r\n<td><strong>\u4e58\u6cd5\u8d4b\u503c\u8fd0\u7b97\u7b26<\/strong>\uff08\u53f3\u5173\u8054\uff09\u3002 \u5c06 with \u7684\u503c\u76f8\u4e58 \u548c \u7684\u539f\u59cb\u503c \u7136\u540e\u5c06\u65b0\u503c\u91cd\u65b0\u5206\u914d\u7ed9 \u3002<samp>y<\/samp><samp>x<\/samp><samp>x<\/samp>\u6ce8\u610f<samp>x<\/samp>\u5e76\u4e14\u5fc5\u987b\u662f\u6574\u6570\u6216 \u53cc\u6253\u6216\u7ec4\u5408\u3002<samp>y<\/samp><samp>x<\/samp>\u800c\u4e14\u4e0d\u53ef\u80fd.<samp>y<\/samp><samp>null<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>-=<\/samp><\/td>\r\n<td><samp>x -= y<\/samp><\/td>\r\n<td><strong>\u51cf\u6cd5\u8d4b\u503c\u8fd0\u7b97\u7b26<\/strong>\uff08\u53f3\u5173\u8054\uff09\u3002\u51cf\u53bb \u7684\u503c\u4ece \u548c \u7684\u539f\u59cb\u503c \u5c06\u65b0\u503c\u91cd\u65b0\u5206\u914d\u7ed9 \u3002<samp>y<\/samp><samp>x<\/samp><samp>x<\/samp>\u6ce8\u610f<samp>x<\/samp>\u5e76\u4e14\u5fc5\u987b\u662f\u6574\u6570\u6216\u53cc\u7cbe\u5ea6 \u6216\u4e24\u8005\u517c\u800c\u6709\u4e4b\u3002<samp>y<\/samp><samp>x<\/samp>\u800c\u4e14\u4e0d\u53ef\u80fd.<samp>y<\/samp><samp>null<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>\/=<\/samp><\/td>\r\n<td><samp>x \/= y<\/samp><\/td>\r\n<td><strong>\u9664\u6cd5\u8d4b\u503c\u8fd0\u7b97\u7b26<\/strong>\uff08\u53f3\u5173\u8054\uff09\u3002\u9664\u4ee5 \u7684\u539f\u59cb\u503c\u4e0e \u7684\u503c\uff0c\u7136\u540e\u91cd\u65b0\u8d4b\u503c \u7684\u65b0\u503c\u3002<samp>x<\/samp><samp>y<\/samp><samp>x<\/samp>\u6ce8\u610f<samp>x<\/samp>\u5e76\u4e14\u5fc5\u987b\u662f\u6574\u6570\u6216\u53cc\u7cbe\u5ea6 \u6216\u4e24\u8005\u517c\u800c\u6709\u4e4b\u3002<samp>y<\/samp><samp>x<\/samp>\u800c\u4e14\u4e0d\u53ef\u80fd.<samp>y<\/samp><samp>null<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>|=<\/samp><\/td>\r\n<td><samp>x |= y<\/samp><\/td>\r\n<td><strong>OR \u8d4b\u503c\u8fd0\u7b97\u7b26<\/strong>\uff08\u53f3\u5173\u8054\uff09\u3002\u5982\u679c \u3001 \u5e03\u5c14\u503c\u548c \u5e03\u5c14\u503c\u5747\u4e3a false\uff0c\u5219\u4fdd\u6301 false\u3002\u5426\u5219\uff0c\u5c06\u8d4b\u503c\u4e3a \u771f\u3002 \u800c\u4e14\u4e0d\u53ef\u80fd.<samp>x<\/samp><samp>y<\/samp><samp>x<\/samp><samp>x<\/samp><samp>x<\/samp><samp>y<\/samp><samp>null<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&amp;=<\/samp><\/td>\r\n<td><samp>x &amp;= y<\/samp><\/td>\r\n<td><strong>AND \u8d4b\u503c\u8fd0\u7b97\u7b26<\/strong>\uff08\u53f3\u5173\u8054\uff09\u3002\u5982\u679c \u3001 \u5e03\u5c14\u503c\u548c \u5e03\u5c14\u503c\u90fd\u4e3a true\uff0c\u5219\u4fdd\u6301\u4e3a true\u3002\u5426\u5219\uff0c\u5c06\u8d4b\u503c\u4e3a \u5047\u3002 \u800c\u4e14\u4e0d\u53ef\u80fd.<samp>x<\/samp><samp>y<\/samp><samp>x<\/samp><samp>x<\/samp><samp>x<\/samp><samp>y<\/samp><samp>null<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&lt;&lt;=<\/samp><\/td>\r\n<td><samp>x &lt;&lt;= y<\/samp><\/td>\r\n<td><strong>\u6309\u4f4d\u5de6\u79fb\u8d4b\u503c\u8fd0\u7b97\u7b26<\/strong>\u3002\u5c06\u6bcf\u4e2a\u4f4d\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\uff0c\u4ee5\u4fbf\u9ad8\u9636\u4f4d \u4e22\u5931\uff0c\u65b0\u7684\u53f3\u4f4d\u8bbe\u7f6e\u4e3a 0\u3002\u6b64\u503c\u4e3a \u91cd\u65b0\u5206\u914d\u7ed9 \u3002<samp>x<\/samp><samp>y<\/samp><samp>x<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&gt;&gt;=<\/samp><\/td>\r\n<td><samp>x &gt;&gt;= y<\/samp><\/td>\r\n<td><strong>\u6309\u4f4d\u53f3\u79fb\u6709\u7b26\u53f7\u8d4b\u503c\u8fd0\u7b97\u7b26<\/strong>\u3002\u6bcf\u4e2a\u73ed\u6b21 \u9010\u4f4d\u5411\u53f3\u63d2\u5165\uff0c\u4ee5\u4fbf \u4f4e\u9636\u4f4d\u4e22\u5931\uff0c\u65b0\u7684\u5de6\u4f4d\u8bbe\u7f6e\u4e3a 0 \u8868\u793a\u6b63\u6570 \u7684\u503c\u4e3a \u548c 1 \u4e3a\u8d1f\u6570 \u7684\u503c\u3002\u6b64\u503c\u4e3a \u91cd\u65b0\u5206\u914d\u7ed9 \u3002<samp>x<\/samp><samp>y<\/samp><samp>y<\/samp><samp>y<\/samp><samp>x<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&gt;&gt;&gt;=<\/samp><\/td>\r\n<td><samp>x &gt;&gt;&gt;= y<\/samp><\/td>\r\n<td><strong>\u6309\u4f4d\u53f3\u79fb\u65e0\u7b26\u53f7\u8d4b\u503c\u8fd0\u7b97\u7b26<\/strong>\u3002\u6bcf\u4e2a\u73ed\u6b21 \u9010\u4f4d\u5411\u53f3\u63d2\u5165\uff0c\u4ee5\u4fbf \u4f4e\u9636\u4f4d\u5c06\u4e22\u5931\uff0c\u65b0\u7684\u5de6\u4f4d\u5c06\u5168\u90e8\u8bbe\u7f6e\u4e3a 0 \u7684\u503c\u3002\u6b64\u503c\u4e3a \u91cd\u65b0\u5206\u914d\u7ed9 \u3002<samp>x<\/samp><samp>y<\/samp><samp>y<\/samp><samp>x<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>? :<\/samp><\/td>\r\n<td><samp>x ? y : z<\/samp><\/td>\r\n<td><strong>\u4e09\u5143\u8fd0\u7b97\u7b26<\/strong>\uff08\u53f3\u5173\u8054\uff09\u3002\u6b64\u8fd0\u7b97\u7b26\u5145\u5f53 if-then-else \u8bed\u53e5\u7684\u7b80\u5199\u3002\u5982\u679c \uff0c\u5e03\u5c14\u503c\u4e3a true\uff0c\u5219\u4e3a\u7ed3\u679c\u3002\u5426\u5219\u5c31\u662f\u7ed3\u679c\u3002<samp>x<\/samp><samp>y<\/samp><samp>z<\/samp>\u6ce8\u610f<samp>x<\/samp>\u4e0d\u53ef\u80fd.<samp>null<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&amp;&amp;<\/samp><\/td>\r\n<td><samp>x &amp;&amp; y<\/samp><\/td>\r\n<td><strong>AND \u903b\u8f91\u8fd0\u7b97\u7b26<\/strong>\uff08\u5de6\u5173\u8054\uff09\u3002\u5982\u679c \u3001 \u5e03\u5c14\u503c\u548c \u5e03\u5c14\u503c\u5747\u4e3a true\uff0c\u5219 \u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a true\u3002\u5426\u5219\uff0c\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a \u5047\u3002<samp>x<\/samp><samp>y<\/samp>\u6ce8\u610f\uff1a<samp>&amp;&amp;<\/samp>\u6709 \u4f18\u5148\u4e8e<samp>||<\/samp>\u8be5\u7b97\u5b50\u8868\u73b0\u51fa\u77ed\u8def\u884c\u4e3a\uff0c\u8fd9 \u624b\u6bb5\u662f \u4ec5\u5f53\u4e3a true \u65f6\u624d\u8ba1\u7b97\u3002<samp>y<\/samp><samp>x<\/samp><samp>x<\/samp>\u800c\u4e14\u4e0d\u53ef\u80fd.<samp>y<\/samp><samp>null<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>||<\/samp><\/td>\r\n<td><samp>x || y<\/samp><\/td>\r\n<td><strong>OR \u903b\u8f91\u8fd0\u7b97\u7b26<\/strong>\uff08\u5de6\u5173\u8054\uff09\u3002\u5982\u679c \u3001\u5e03\u5c14\u503c\u548c\u5e03\u5c14\u503c\u5747\u4e3a false\uff0c\u5219 \u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a false\u3002\u5426\u5219\uff0c\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a \u771f\u3002<samp>x<\/samp><samp>y<\/samp>\u6ce8\u610f\uff1a<samp>&amp;&amp;<\/samp>\u6709 \u4f18\u5148\u4e8e<samp>||<\/samp>\u8be5\u7b97\u5b50\u8868\u73b0\u51fa\u77ed\u8def\u884c\u4e3a\uff0c\u8fd9 \u624b\u6bb5\u662f \u4ec5\u5f53\u4e3a false \u65f6\u624d\u8ba1\u7b97\u3002<samp>y<\/samp><samp>x<\/samp><samp>x<\/samp>\u800c\u4e14\u4e0d\u53ef\u80fd.<samp>y<\/samp><samp>null<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>==<\/samp><\/td>\r\n<td><samp>x == y<\/samp><\/td>\r\n<td><strong>\u76f8\u7b49\u8fd0\u7b97\u7b26<\/strong>\u3002\u5982\u679c \u7684\u503c\u7b49\u4e8e \u7684\u503c\uff0c\u5219\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a \u771f\u3002\u5426\u5219\uff0c\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a false\u3002<samp>x<\/samp><samp>y<\/samp>\u6ce8\u610f\u4e0e Java \u4e0d\u540c\uff0c\u5728 Apex \u6bd4\u8f83\u5bf9\u8c61\u503c\u76f8\u7b49\u6027\u800c\u4e0d\u662f\u5f15\u7528\u76f8\u7b49\u6027\uff0c \u7528\u6237\u5b9a\u4e49\u7c7b\u578b\u9664\u5916\u3002\u56e0\u6b64\uff1a<samp>==<\/samp>\u5bf9\u4e8e sObjects \u548c sObject \u6570\u7ec4\uff0c\u6267\u884c\u6df1\u5ea6 \u5728\u8fd4\u56de\u5176\u4e4b\u524d\u68c0\u67e5\u6240\u6709 sObject \u5b57\u6bb5\u503c \u7ed3\u679c\u3002 \u540c\u6837 \u7528\u4e8e\u96c6\u5408\u548c\u5185\u7f6e Apex \u5bf9\u8c61\u3002<samp>==<\/samp>\u5bf9\u4e8e\u8bb0\u5f55\uff0c\u6bcf\u4e2a\u5b57\u6bb5\u5fc5\u987b\u5177\u6709\u76f8\u540c\u7684\u503c\u624d\u80fd\u8fdb\u884c\u8bc4\u4f30 \u5230\u771f\u3002<samp>==<\/samp><samp>x<\/samp>\u6216\u8005\u53ef\u4ee5\u662f\u5b57\u9762\u4e0a\u7684\u3002<samp>y<\/samp><samp>null<\/samp>\u4efb\u4f55\u4e24\u4e2a\u503c\u7684\u6bd4\u8f83\u90fd\u4e0d\u80fd\u4ea7\u751f \u3002<samp>null<\/samp>SOQL \u548c SOSL \u7528\u4e8e\u5b83\u4eec\u7684\u76f8\u7b49\u8fd0\u7b97\u7b26\uff0c\u800c\u4e0d\u662f .\u867d\u7136 Apex \u548c SOQL \u548c SOSL \u662f\u7d27\u5bc6\u76f8\u8fde\u7684\uff0c\u8fd9\u79cd\u4e0d\u5e78\u7684\u8bed\u6cd5 \u4e4b\u6240\u4ee5\u5b58\u5728\u5dee\u5f02\uff0c\u662f\u56e0\u4e3a\u5927\u591a\u6570\u73b0\u4ee3\u8bed\u8a00\u90fd\u7528\u4e8e\u8d4b\u503c\u548c \u5e73\u7b49\u3002Apex \u7684\u8bbe\u8ba1\u8005\u8ba4\u4e3a\u5b83\u66f4\u6709\u4ef7\u503c \u4fdd\u6301\u8fd9\u79cd\u8303\u5f0f\uff0c\u800c\u4e0d\u662f\u5f3a\u8feb\u5f00\u53d1\u4eba\u5458\u5b66\u4e60 \u65b0\u7684\u8d4b\u503c\u8fd0\u7b97\u7b26\u3002\u56e0\u6b64\uff0cApex \u5f00\u53d1\u4eba\u5458\u5fc5\u987b \u7528\u4e8e\u5e73\u7b49 \u5728 Apex \u4ee3\u7801\u7684\u4e3b\u4f53\u4e2d\u8fdb\u884c\u6d4b\u8bd5\uff0c\u5e76\u5728 SOQL \u4e2d\u8fdb\u884c\u76f8\u7b49\u6027\u6d4b\u8bd5 \u548c SOSL \u67e5\u8be2\u3002<samp>=<\/samp><samp>==<\/samp><samp>=<\/samp><samp>==<\/samp><samp>==<\/samp><samp>=<\/samp>\u4f7f\u7528 is \u8fdb\u884c\u5b57\u7b26\u4e32\u6bd4\u8f83 \u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff0c\u5e76\u6839\u636e \u4e0a\u4e0b\u6587\u7528\u6237\u7684\u533a\u57df\u8bbe\u7f6e<samp>==<\/samp>ID \u6bd4\u8f83\u4f7f\u7528\u533a\u5206\u5927\u5c0f\u5199\uff0c\u4e0d\u533a\u5206\u5927\u5c0f\u5199 \u533a\u5206 15 \u4e2a\u5b57\u7b26\u548c 18 \u4e2a\u5b57\u7b26 \u683c\u5f0f<samp>==<\/samp>\u7528\u6237\u5b9a\u4e49\u7684\u7c7b\u578b\u901a\u8fc7\u5f15\u7528\u8fdb\u884c\u6bd4\u8f83\uff0c\u5176\u4e2d \u8868\u793a\u4e24\u4e2a\u5bf9\u8c61\u53ea\u6709\u5728\u5b83\u4eec \u5f15\u7528\u5185\u5b58\u4e2d\u7684\u76f8\u540c\u4f4d\u7f6e\u3002\u60a8\u53ef\u4ee5 \u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u8986\u76d6\u6b64\u9ed8\u8ba4\u6bd4\u8f83\u884c\u4e3a \u63d0\u4f9b\u548c\u65b9\u6cd5 \u6765\u6bd4\u8f83\u5bf9\u8c61\u503c\u3002<samp>equals<\/samp><samp>hashCode<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>===<\/samp><\/td>\r\n<td><samp>x === y<\/samp><\/td>\r\n<td><strong>\u5b8c\u5168\u76f8\u7b49\u8fd0\u7b97\u7b26<\/strong>\u3002If \u548c\u5f15\u7528 \u8868\u8fbe\u5f0f\u5728\u5185\u5b58\u4e2d\u8ba1\u7b97\u7ed3\u679c\u4e3a true \u7684\u4f4d\u7f6e\u5b8c\u5168\u76f8\u540c\u3002 \u5426\u5219\uff0c\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a false\u3002<samp>x<\/samp><samp>y<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&lt;<\/samp><\/td>\r\n<td><samp>x &lt; y<\/samp><\/td>\r\n<td><strong>\u5c0f\u4e8e\u64cd\u4f5c\u5458<\/strong>\u3002\u5982\u679c\u5c0f\u4e8e \uff0c \u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a true\u3002\u5426\u5219\uff0c\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a \u5047\u3002<samp>x<\/samp><samp>y<\/samp>\u6ce8\u610f\u4e0e\u5176\u4ed6\u6570\u636e\u5e93\u5b58\u50a8\u8fc7\u7a0b\u4e0d\u540c\uff0cApex \u6ca1\u6709 \u652f\u6301\u4e09\u6001\u5e03\u5c14\u903b\u8f91\u548c\u4efb\u4f55\u4e24\u4e2a\u503c\u7684\u6bd4\u8f83\u90fd\u4e0d\u80fd\u4ea7\u751f \u3002<samp>null<\/samp>\u5982\u679c \u6216 \u7b49\u4e8e \u5e76\u4e14\u662f\u6574\u6570\uff0c Doubles\u3001Dates \u6216 Datetimes\uff0c\u5219\u8868\u8fbe\u5f0f\u4e3a false\u3002<samp>x<\/samp><samp>y<\/samp><samp>null<\/samp>\u975e\u5b57\u7b26\u4e32\u6216 ID \u503c\u59cb\u7ec8\u8f83\u5927 \u6bd4\u4e00\u4e2a\u503c\u3002<samp>null<\/samp><samp>null<\/samp>\u5982\u679c \u548c \u662f ID\uff0c \u5b83\u4eec\u5fc5\u987b\u5f15\u7528\u76f8\u540c\u7c7b\u578b\u7684\u5bf9\u8c61\u3002\u5426\u5219 \u8fd0\u884c\u65f6\u9519\u8bef\u7ed3\u679c\u3002<samp>x<\/samp><samp>y<\/samp>\u5982\u679c or \u662f ID \u548c other value \u662f String\uff0c\u5219\u9a8c\u8bc1 String \u503c \u5e76\u88ab\u89c6\u4e3a ID\u3002<samp>x<\/samp><samp>y<\/samp><samp>x<\/samp>\u800c\u4e14\u4e0d\u53ef\u80fd \u5e03\u5c14 \u503c\u3002<samp>y<\/samp>\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u6bd4\u8f83\u662f\u6839\u636e \u4e0a\u4e0b\u6587\u7528\u6237\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u5e76\u4e14\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u3002<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&gt;<\/samp><\/td>\r\n<td><samp>x &gt; y<\/samp><\/td>\r\n<td><strong>\u5927\u4e8e\u8fd0\u7b97\u7b26<\/strong>\u3002\u5982\u679c\u5927\u4e8e \uff0c\u5219\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a true\u3002\u5426\u5219\uff0c \u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a false\u3002<samp>x<\/samp><samp>y<\/samp>\u6ce8\u610f\u4efb\u4f55\u4e24\u4e2a\u503c\u7684\u6bd4\u8f83\u90fd\u4e0d\u80fd\u4ea7\u751f \u3002<samp>null<\/samp>\u5982\u679c \u6216 \u7b49\u4e8e \u5e76\u4e14\u662f\u6574\u6570\uff0c Doubles\u3001Dates \u6216 Datetimes\uff0c\u5219\u8868\u8fbe\u5f0f\u4e3a false\u3002<samp>x<\/samp><samp>y<\/samp><samp>null<\/samp>\u975e\u5b57\u7b26\u4e32 \u6216 ID \u503c\u59cb\u7ec8\u5927\u4e8e\u67d0\u4e2a\u503c\u3002<samp>null<\/samp><samp>null<\/samp>\u5982\u679c \u548c \u662f ID\uff0c\u5219\u5b83\u4eec\u5fc5\u987b \u5f15\u7528\u76f8\u540c\u7c7b\u578b\u7684\u5bf9\u8c61\u3002\u5426\u5219\u4e3a\u8fd0\u884c\u65f6\u9519\u8bef \u7ed3\u679c\u3002<samp>x<\/samp><samp>y<\/samp>\u5982\u679c or \u662f ID \u548c other value \u662f String\uff0c\u5bf9 String \u503c\u8fdb\u884c\u9a8c\u8bc1\uff0c\u5e76\u4e14 \u89c6\u4e3a ID\u3002<samp>x<\/samp><samp>y<\/samp><samp>x<\/samp>\u800c\u4e14\u4e0d\u53ef\u80fd \u5e03\u5c14 \u503c\u3002<samp>y<\/samp>\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u6bd4\u8f83\u662f\u6839\u636e \u4e0a\u4e0b\u6587\u7528\u6237\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u5e76\u4e14\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u3002<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&lt;=<\/samp><\/td>\r\n<td><samp>x &lt;= y<\/samp><\/td>\r\n<td><strong>\u5c0f\u4e8e\u6216\u7b49\u4e8e\u8fd0\u7b97\u7b26<\/strong>\u3002\u5982\u679c\u5c0f\u4e8e\u6216\u7b49\u4e8e \uff0c\u5219\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a \u771f\u3002\u5426\u5219\uff0c\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a false\u3002<samp>x<\/samp><samp>y<\/samp>NoteThe comparison of any two values can never result in\u00a0.<samp>null<\/samp>If\u00a0or\u00a0equal\u00a0and are Integers, Doubles, Dates, or Datetimes, the expression is false.<samp>x<\/samp><samp>y<\/samp><samp>null<\/samp>A non-\u00a0String or ID value is always greater than a\u00a0value.<samp>null<\/samp><samp>null<\/samp>If\u00a0and\u00a0are IDs, they must reference the same type of object. Otherwise a runtime error results.<samp>x<\/samp><samp>y<\/samp>\u5982\u679c or \u662f ID \u548c other value \u662f String\uff0c\u5bf9 String \u503c\u8fdb\u884c\u9a8c\u8bc1\uff0c\u5e76\u4e14 \u89c6\u4e3a ID\u3002<samp>x<\/samp><samp>y<\/samp><samp>x<\/samp>\u800c\u4e14\u4e0d\u53ef\u80fd \u5e03\u5c14 \u503c\u3002<samp>y<\/samp>\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u6bd4\u8f83\u662f\u6839\u636e \u4e0a\u4e0b\u6587\u7528\u6237\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u5e76\u4e14\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u3002<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&gt;=<\/samp><\/td>\r\n<td><samp>x &gt;= y<\/samp><\/td>\r\n<td><strong>\u5927\u4e8e\u6216\u7b49\u4e8e\u8fd0\u7b97\u7b26<\/strong>\u3002\u5982\u679c\u5927\u4e8e\u6216\u7b49\u4e8e \uff0c\u5219\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c \u5230\u771f\u3002\u5426\u5219\uff0c\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a false\u3002<samp>x<\/samp><samp>y<\/samp>\u6ce8\u610f\u4efb\u4f55\u4e24\u4e2a\u503c\u7684\u6bd4\u8f83\u90fd\u4e0d\u80fd\u4ea7\u751f \u3002<samp>null<\/samp>\u5982\u679c \u6216 \u7b49\u4e8e \u5e76\u4e14\u662f\u6574\u6570\uff0c Doubles\u3001Dates \u6216 Datetimes\uff0c\u5219\u8868\u8fbe\u5f0f\u4e3a false\u3002<samp>x<\/samp><samp>y<\/samp><samp>null<\/samp>\u975e\u5b57\u7b26\u4e32 \u6216 ID \u503c\u59cb\u7ec8\u5927\u4e8e\u67d0\u4e2a\u503c\u3002<samp>null<\/samp><samp>null<\/samp>\u5982\u679c \u548c \u662f ID\uff0c\u5219\u5b83\u4eec\u5fc5\u987b \u5f15\u7528\u76f8\u540c\u7c7b\u578b\u7684\u5bf9\u8c61\u3002\u5426\u5219\u4e3a\u8fd0\u884c\u65f6\u9519\u8bef \u7ed3\u679c\u3002<samp>x<\/samp><samp>y<\/samp>\u5982\u679c or \u662f ID \u548c other value \u662f String\uff0c\u5bf9 String \u503c\u8fdb\u884c\u9a8c\u8bc1\uff0c\u5e76\u4e14 \u89c6\u4e3a ID\u3002<samp>x<\/samp><samp>y<\/samp><samp>x<\/samp>\u800c\u4e14\u4e0d\u53ef\u80fd \u5e03\u5c14 \u503c\u3002<samp>y<\/samp>\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u6bd4\u8f83\u662f\u6839\u636e \u4e0a\u4e0b\u6587\u7528\u6237\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u5e76\u4e14\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u3002<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>!=<\/samp><\/td>\r\n<td><samp>x != y<\/samp><\/td>\r\n<td><strong>\u4e0d\u7b49\u5f0f\u8fd0\u7b97\u7b26<\/strong>\u3002\u5982\u679c \u7684\u503c\u4e0d\u7b49\u4e8e \u7684\u503c \uff0c\u5219\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a \u5230\u771f\u3002\u5426\u5219\uff0c\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a false\u3002<samp>x<\/samp><samp>y<\/samp>\u6ce8\u610f\u5b57\u7b26\u4e32\u6bd4\u8f83\u4f7f\u7528\u4e0d\u533a\u5206\u5927\u5c0f\u5199<samp>!=<\/samp>\u4e0e Java \u4e0d\u540c\uff0c\u5728 Apex \u6bd4\u8f83\u5bf9\u8c61\u503c\u76f8\u7b49\u6027\u800c\u4e0d\u662f\u5f15\u7528\u76f8\u7b49\u6027\uff0c \u7528\u6237\u5b9a\u4e49\u7c7b\u578b\u9664\u5916\u3002<samp>!=<\/samp>\u5bf9\u4e8e sObjects \u548c sObject \u6570\u7ec4\uff0c\u6267\u884c\u6df1\u5ea6 \u5728\u8fd4\u56de\u5176\u4e4b\u524d\u68c0\u67e5\u6240\u6709 sObject \u5b57\u6bb5\u503c \u7ed3\u679c\u3002<samp>!=<\/samp>\u5bf9\u4e8e\u8bb0\u5f55\uff0c\u5982\u679c\u8bb0\u5f55\u5177\u6709\u4e0d\u540c\u7684\u503c\uff0c\u5219\u8ba1\u7b97\u7ed3\u679c\u4e3a true \u4efb\u4f55\u5b57\u6bb5\u3002<samp>!=<\/samp>\u7528\u6237\u5b9a\u4e49\u7684\u7c7b\u578b\u901a\u8fc7\u5f15\u7528\u8fdb\u884c\u6bd4\u8f83\uff0c\u8fd9\u610f\u5473\u7740 \u53ea\u6709\u5f53\u4e24\u4e2a\u5bf9\u8c61\u5f15\u7528\u65f6\uff0c\u5b83\u4eec\u624d\u4e0d\u540c \u5185\u5b58\u4e2d\u7684\u4e0d\u540c\u4f4d\u7f6e\u3002\u60a8\u53ef\u4ee5\u8986\u76d6\u6b64\u9ed8\u8ba4\u503c \u901a\u8fc7\u63d0\u4f9b \u548c \u65b9\u6cd5\u6765\u6bd4\u8f83\u884c\u4e3a \u7c7b\u6765\u6bd4\u8f83\u5bf9\u8c61\u503c\u3002<samp>equals<\/samp><samp>hashCode<\/samp><samp>x<\/samp>\u6216\u8005<em>\u53ef\u4ee5<\/em>\u662f\u5b57\u9762\u4e0a\u7684\u3002<samp>y<\/samp><samp>null<\/samp>\u4efb\u4f55\u4e24\u4e2a\u503c\u7684\u6bd4\u8f83\u90fd\u4e0d\u80fd\u4ea7\u751f \u3002<samp>null<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>!==<\/samp><\/td>\r\n<td><samp>x !== y<\/samp><\/td>\r\n<td><strong>\u7cbe\u786e\u4e0d\u7b49\u5f0f\u8fd0\u7b97\u7b26<\/strong>\u3002\u5982\u679c\u548c\u4e0d \u5f15\u7528\u5185\u5b58\u4e2d\u5b8c\u5168\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a \u771f\u3002\u5426\u5219\uff0c\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a false\u3002<samp>x<\/samp><samp>y<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>+<\/samp><\/td>\r\n<td><samp>x + y<\/samp><\/td>\r\n<td><strong>\u52a0\u6cd5\u8fd0\u7b97\u7b26<\/strong>\u3002\u6839\u636e\u4ee5\u4e0b\u89c4\u5219\u5c06 \u7684\u503c\u6dfb\u52a0\u5230 \u7684\u503c\u4e2d\uff1a<samp>x<\/samp><samp>y<\/samp>\u5982\u679c \u548c \u662f\u6574\u6570\u6216\u53cc\u7cbe\u5ea6\uff0c \u8fd0\u7b97\u7b26\u5c06 \u7684\u503c\u4e0e \u7684\u503c\u76f8\u52a0\u3002\u5982\u679c\u4f7f\u7528 Double\uff0c\u5219\u7ed3\u679c\u4e3a \u53cc\u3002<samp>x<\/samp><samp>y<\/samp><samp>x<\/samp><samp>y<\/samp>\u5982\u679c\u662f Date \u5e76\u4e14\u662f Integer\uff0c \u8fd4\u56de\u6309\u6307\u5b9a\u6570\u5b57\u9012\u589e\u7684\u65b0\u65e5\u671f \u5929\u3002<samp>x<\/samp><samp>y<\/samp>If \u662f Datetime \u5e76\u4e14\u662f Integer \u6216 Double\uff0c\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684 Date\uff0c\u8be5\u65e5\u671f\u6309\u6307\u5b9a\u7684 \u5929\u6570\uff0c\u5c0f\u6570\u90e8\u5206\u5bf9\u5e94\u4e8e \u4e00\u5929\u7684\u4e00\u90e8\u5206\u3002<samp>x<\/samp><samp>y<\/samp>If \u662f String \u5e76\u4e14\u662f String \u6216 \u4efb\u4f55\u5176\u4ed6\u7c7b\u578b\u7684\u975e\u53c2\u6570\uff0c\u90fd\u8fde\u63a5\u5230 \u7684\u672b\u5c3e\u3002<samp>x<\/samp><samp>y<\/samp><samp>null<\/samp><samp>y<\/samp><samp>x<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&#8211;<\/samp><\/td>\r\n<td><samp>x &#8211; y<\/samp><\/td>\r\n<td><strong>\u51cf\u6cd5\u8fd0\u7b97\u7b26<\/strong>\u3002\u6839\u636e\u4ee5\u4e0b\u89c4\u5219\u4ece \u7684\u503c\u4e2d\u51cf\u53bb \u7684\u503c\uff1a<samp>y<\/samp><samp>x<\/samp>\u5982\u679c \u548c \u662f\u6574\u6570\u6216\u53cc\u7cbe\u5ea6\uff0c \u8fd0\u7b97\u7b26\u4ece \u7684\u503c\u4e2d\u51cf\u53bb \u7684\u503c\u3002\u5982\u679c\u4f7f\u7528 Double\uff0c\u5219 \u7ed3\u679c\u662f Double\u3002<samp>x<\/samp><samp>y<\/samp><samp>y<\/samp><samp>x<\/samp>\u5982\u679c\u662f Date \u5e76\u4e14\u662f Integer\uff0c \u8fd4\u56de\u4e00\u4e2a\u6309\u6307\u5b9a\u6570\u5b57\u9012\u51cf\u7684\u65b0 Date \u5929\u3002<samp>x<\/samp><samp>y<\/samp>If \u662f Datetime \u5e76\u4e14\u662f Integer \u6216 Double\uff0c\u8fd4\u56de\u4e00\u4e2a\u51cf\u53bb\u6307\u5b9a\u503c\u7684\u65b0\u65e5\u671f \u5929\u6570\uff0c\u5c0f\u6570\u90e8\u5206\u5bf9\u5e94\u4e8e \u4e00\u5929\u7684\u4e00\u90e8\u5206\u3002<samp>x<\/samp><samp>y<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>*<\/samp><\/td>\r\n<td><samp>x * y<\/samp><\/td>\r\n<td><strong>\u4e58\u6cd5\u8fd0\u7b97\u7b26<\/strong>\u3002\u5c06 \u3001 \u6574\u6570\u6216 Double \u4e0e \u3001 \u53e6\u4e00\u4e2a Integer \u6216 \u76f8\u4e58 \u53cc\u3002\u5982\u679c\u4f7f\u7528 double\uff0c\u5219\u7ed3\u679c\u4e3a double\u3002<samp>x<\/samp><samp>y<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>\/<\/samp><\/td>\r\n<td><samp>x \/ y<\/samp><\/td>\r\n<td><strong>\u90e8\u95e8\u64cd\u4f5c\u5458<\/strong>\u3002\u5c06\u4e00\u4e2a\u6574\u6570\u6216\u53cc\u7cbe\u5ea6\u9664\u4ee5\u53e6\u4e00\u4e2a\u6574\u6570\u6216\u53cc\u7cbe\u5ea6\u3002\u5982\u679c double\uff0c\u7ed3\u679c\u662f Double\u3002<samp>x<\/samp><samp>y<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>!<\/samp><\/td>\r\n<td><samp>!x<\/samp><\/td>\r\n<td><strong>\u903b\u8f91\u8865\u7801\u8fd0\u7b97\u7b26<\/strong>\u3002\u53cd\u8f6c\u5e03\u5c14\u503c\uff0c\u56e0\u6b64 \u771f\u53d8\u6210\u5047\uff0c\u5047\u53d8\u6210\u771f\u3002<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&#8211;<\/samp><\/td>\r\n<td><samp>-x<\/samp><\/td>\r\n<td><strong>\u4e00\u5143\u5426\u5b9a\u8fd0\u7b97\u7b26<\/strong>\u3002\u5c06 \u3001 \u6574\u6570\u6216\u53cc\u7cbe\u5ea6\u7684\u503c\u4e58\u4ee5 -1\u3002\u8fd9 \u6b63\u7b49\u4ef7\u7269\u4e5f\u662f \u8bed\u6cd5\u4e0a\u6709\u6548\uff0c\u4f46\u6ca1\u6709\u6570\u5b66\u6548\u679c\u3002<samp>x<\/samp><samp>+<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>++<\/samp><\/td>\r\n<td><samp>x++<\/samp><samp>++x<\/samp><\/td>\r\n<td><strong>\u589e\u91cf\u8fd0\u7b97\u7b26<\/strong>\u3002\u5c06 1 \u6dfb\u52a0\u5230\u6570\u503c\u7c7b\u578b\u7684\u53d8\u91cf \u7684\u503c\u4e0a\u3002\u5982\u679c \u524d\u7f00 \uff08\uff09\uff0c\u8868\u8fbe\u5f0f \u589e\u91cf\u540e\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a x \u7684\u503c\u3002\u5982\u679c\u540e\u7f00\u4e3a \uff08\uff09\uff0c\u5219\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a \u589e\u91cf\u524d\u7684 x \u503c\u3002<samp>x<\/samp><samp>++x<\/samp><samp>x++<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&#8212;<\/samp><\/td>\r\n<td><samp>x&#8211;<\/samp><samp>&#8211;x<\/samp><\/td>\r\n<td><strong>\u9012\u51cf\u8fd0\u7b97\u7b26<\/strong>\u3002\u4ece \u7684\u503c\u4e2d\u51cf\u53bb 1\uff0c\u8fd9\u662f\u4e00\u4e2a\u6570\u503c\u7c7b\u578b\u7684\u53d8\u91cf\u3002\u5982\u679c \u524d\u7f00 \uff08\uff09\uff0c\u8868\u8fbe\u5f0f \u8ba1\u7b97\u7ed3\u679c\u4e3a\u9012\u51cf\u540e\u7684 x \u503c\u3002\u5982\u679c\u540e\u7f00\u4e3a \uff08\uff09\uff0c\u5219\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a \u9012\u51cf\u524d\u7684 x \u503c\u3002<samp>x<\/samp><samp>&#8211;x<\/samp><samp>x&#8211;<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&amp;<\/samp><\/td>\r\n<td><samp>x &amp; y<\/samp><\/td>\r\n<td><strong>\u6309\u4f4d AND \u8fd0\u7b97\u7b26<\/strong>\u3002AND \u5c06\u6bcf\u4e2a\u4f4d in \u4e0e\u76f8\u5e94\u7684\u4f4d in \u4e00\u8d77\uff0c\u4f7f\u7ed3\u679c\u4f4d\u4e3a \u5982\u679c\u4e24\u4e2a\u4f4d\u90fd\u8bbe\u7f6e\u4e3a 1\uff0c\u5219\u8bbe\u7f6e\u4e3a 1\u3002<samp>x<\/samp><samp>y<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>|<\/samp><\/td>\r\n<td><samp>x | y<\/samp><\/td>\r\n<td><strong>\u6309\u4f4d OR \u8fd0\u7b97\u7b26<\/strong>\u3002OR\u5c06\u6bcf\u4e2a\u4f4d\u8f93\u5165\u5230\u76f8\u5e94\u7684\u4f4d\uff0c\u4ee5\u4fbf\u7ed3\u679c\u4f4d\u4e3a \u5982\u679c\u81f3\u5c11\u6709\u4e00\u4e2a\u4f4d\u8bbe\u7f6e\u4e3a 1\uff0c\u5219\u8bbe\u7f6e\u4e3a 1\u3002<samp>x<\/samp><samp>y<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>^<\/samp><\/td>\r\n<td><samp>x ^ y<\/samp><\/td>\r\n<td><strong>\u6309\u4f4d\u72ec\u5360 OR \u8fd0\u7b97\u7b26<\/strong>\u3002\u6bcf\u4e2a\u4f4d\u7684\u72ec\u5360 OR \u4e0e\u76f8\u5e94\u7684 \u4f4d\uff0c\u4ee5\u4fbf\u7ed3\u679c\u4f4d \u5982\u679c\u6070\u597d\u5176\u4e2d\u4e00\u4e2a\u4f4d\u8bbe\u7f6e\u4e3a 1\uff0c\u800c\u53e6\u4e00\u4e2a\u4f4d\u8bbe\u7f6e\u4e3a 1\uff0c\u5219\u8bbe\u7f6e\u4e3a 1 \u8bbe\u7f6e\u4e3a 0\u3002<samp>x<\/samp><samp>y<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>^=<\/samp><\/td>\r\n<td><samp>x ^= y<\/samp><\/td>\r\n<td><strong>\u6309\u4f4d\u72ec\u5360 OR \u8fd0\u7b97\u7b26<\/strong>\u3002\u6bcf\u4e2a\u4f4d\u7684\u72ec\u5360 OR \u4e0e\u76f8\u5e94\u7684 \u4f4d\uff0c\u4ee5\u4fbf\u7ed3\u679c\u4f4d \u5982\u679c\u6070\u597d\u5176\u4e2d\u4e00\u4e2a\u4f4d\u8bbe\u7f6e\u4e3a 1\uff0c\u800c\u53e6\u4e00\u4e2a\u4f4d\u8bbe\u7f6e\u4e3a 1\uff0c\u5219\u8bbe\u7f6e\u4e3a 1 \u8bbe\u7f6e\u4e3a 0\u3002\u5c06\u72ec\u5360 OR \u8fd0\u7b97\u7684\u7ed3\u679c\u5206\u914d\u7ed9 \u3002<samp>x<\/samp><samp>y<\/samp><samp>x<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&lt;&lt;<\/samp><\/td>\r\n<td><samp>x &lt;&lt; y<\/samp><\/td>\r\n<td><strong>\u6309\u4f4d\u5de6\u79fb\u8fd0\u7b97\u7b26<\/strong>\u3002\u5c06\u6bcf\u4e2a\u4f4d\u5411\u5de6\u79fb\u52a8\u4e00\u4f4d\uff0c\u4ee5\u4fbf\u9ad8\u9636\u4f4d \u4e22\u5931\uff0c\u65b0\u7684\u53f3\u4f4d\u8bbe\u7f6e\u4e3a 0\u3002<samp>x<\/samp><samp>y<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&gt;&gt;<\/samp><\/td>\r\n<td><samp>x &gt;&gt; y<\/samp><\/td>\r\n<td><strong>\u6309\u4f4d\u53f3\u79fb\u6709\u7b26\u53f7\u8fd0\u7b97\u7b26<\/strong>\u3002\u5c06\u6bcf\u4e2a\u4f4d\u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\uff0c\u4ee5\u4fbf\u4f4e\u9636\u4f4d \u4e22\u5931\uff0c\u65b0\u7684\u5de6\u4f4d\u8bbe\u7f6e\u4e3a 0 \u8868\u793a\u6b63\u503c\uff0c1 \u8868\u793a\u8d1f\u503c \u4e4b\u3002<samp>x<\/samp><samp>y<\/samp><samp>y<\/samp><samp>y<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>&gt;&gt;&gt;<\/samp><\/td>\r\n<td><samp>x &gt;&gt;&gt; y<\/samp><\/td>\r\n<td><strong>\u6309\u4f4d\u53f3\u79fb\u65e0\u7b26\u53f7\u8fd0\u7b97\u7b26<\/strong>\u3002\u5c06\u6bcf\u4e2a\u4f4d\u5411\u53f3\u79fb\u52a8\u4e00\u4f4d\uff0c\u4ee5\u4fbf\u4f4e\u9636\u4f4d \u4e22\u5931\uff0c\u5e76\u4e14 \u7684\u6240\u6709\u503c\u7684\u65b0\u5de6\u4f4d\u90fd\u8bbe\u7f6e\u4e3a 0\u3002<samp>x<\/samp><samp>y<\/samp><samp>y<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>~<\/samp><\/td>\r\n<td><samp>~x<\/samp><\/td>\r\n<td><strong>\u6309\u4f4d Not \u6216 Complement \u8fd0\u7b97\u7b26<\/strong>\u3002\u5207\u6362\u6bcf\u4e2a\u4e8c\u8fdb\u5236\u6570\u5b57 \u7684 \uff0c\u5c06 0 \u8f6c\u6362\u4e3a 1 \u548c 1 \u66f4\u6539\u4e3a 0\u3002\u5e03\u5c14\u503c\u4ece to \u548c vice \u8f6c\u6362 \u53cd\u4e4b\u4ea6\u7136\u3002<samp>x<\/samp><samp>True<\/samp><samp>False<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>()<\/samp><\/td>\r\n<td><samp>(x)<\/samp><\/td>\r\n<td><strong>\u62ec\u53f7<\/strong>\u3002\u63d0\u5347\u8868\u8fbe\u5f0f\u7684\u4f18\u5148\u7ea7\uff0c\u4ee5\u4fbf\u9996\u5148\u5728 \u590d\u5408\u8868\u8fbe\u5f0f\u3002<samp>x<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><samp>?.<\/samp><\/td>\r\n<td>x?.y<\/td>\r\n<td><strong>\u5b89\u5168\u5bfc\u822a\u64cd\u4f5c\u5458<\/strong>\u3002\u77ed\u8def\u8868\u8fbe\u5f0f \u5c1d\u8bd5\u5bf9 null \u503c\u8fdb\u884c\u64cd\u4f5c\uff0c\u5e76\u8fd4\u56de null \u800c\u4e0d\u662f\u629b\u51fa \u4e00\u4e2a NullPointerException\u3002\u5982\u679c\u94fe\u8868\u8fbe\u5f0f\u7684\u5de6\u4fa7 \u8ba1\u7b97\u7ed3\u679c\u4e3a null\uff0c\u5219\u94fe\u8868\u8fbe\u5f0f\u7684\u53f3\u4fa7\u4e0d\u662f \u8bc4\u4ef7\u3002<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/figure>\r\n\r\n\r\n\r\n<h1 class=\"wp-block-heading\">\u5b89\u5168\u5bfc\u822a\u64cd\u4f5c\u5458<\/h1>\r\n\r\n\r\n\r\n<p>\u4f7f\u7528\u5b89\u5168\u5bfc\u822a\u8fd0\u7b97\u7b26 \uff08\uff09 \u66ff\u6362\u5bf9 null \u5f15\u7528\u7684\u663e\u5f0f\u987a\u5e8f\u68c0\u67e5\u3002\u8fd9 \u8fd0\u7b97\u7b26\u77ed\u8def\u5c1d\u8bd5\u5bf9 null \u503c\u8fdb\u884c\u64cd\u4f5c\u5e76\u8fd4\u56de\u7684\u8868\u8fbe\u5f0f null \u800c\u4e0d\u662f\u629b\u51fa NullPointerException\u3002<samp>?.<\/samp><\/p>\r\n\r\n\r\n\r\n<p>\u91cd\u8981<\/p>\r\n\r\n\r\n\r\n<p>\u5728\u53ef\u80fd\u7684\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u66f4\u6539\u4e86\u975e\u5305\u5bb9\u6027\u6761\u6b3e\uff0c\u4ee5\u7b26\u5408\u6211\u4eec\u7684 \u5e73\u7b49\u7684\u516c\u53f8\u4ef7\u503c\u89c2\u3002\u6211\u4eec\u4fdd\u7559\u4e86\u67d0\u4e9b\u6761\u6b3e\uff0c\u4ee5\u907f\u514d\u5bf9 \u5ba2\u6237\u5b9e\u65bd\u3002<\/p>\r\n\r\n\r\n\r\n<p>\u5982\u679c\u94fe\u8868\u8fbe\u5f0f\u7684\u5de6\u4fa7\u8ba1\u7b97\u7ed3\u679c\u4e3a null\uff0c\u5219\u53f3\u4fa7\u7684\u8ba1\u7b97\u7ed3\u679c\u4e3a null \u672a\u8fdb\u884c\u8bc4\u4f30\u3002\u5728\u65b9\u6cd5\u3001\u53d8\u91cf\u548c\u5c5e\u6027\u94fe\u63a5\u4e2d\u4f7f\u7528\u5b89\u5168\u5bfc\u822a\u8fd0\u7b97\u7b26 \uff08\uff09\u3002\u90e8\u5206 \u672a\u8ba1\u7b97\u7684\u8868\u8fbe\u5f0f\u53ef\u4ee5\u5305\u62ec\u53d8\u91cf\u5f15\u7528\u3001\u65b9\u6cd5\u5f15\u7528\u3001 \u6216\u6570\u7ec4\u8868\u8fbe\u5f0f\u3002<samp>?.<\/samp><\/p>\r\n\r\n\r\n\r\n<p>\u6ce8\u610f<\/p>\r\n\r\n\r\n\r\n<p>\u6240\u6709 Apex \u7c7b\u578b\u90fd\u53ef\u4ee5\u9690\u5f0f\u4e3a null\uff0c\u5e76\u4e14\u53ef\u4ee5\u4fdd\u5b58\u4ece \u7b97\u5b50\u3002<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">\u4f8b\u5b50<\/h2>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>\u6b64\u793a\u4f8b\u9996\u5148\u8ba1\u7b97 \uff0c\u5e76\u4e14 \u5982\u679c\u4e3a null\uff0c\u5219\u8fd4\u56de null\u3002\u5426\u5219\uff0c \u8fd4\u56de\u503c\u4e3a \u3002<samp>a<\/samp><samp>a<\/samp><samp>a.b<\/samp><code>a?.b \/\/ Evaluates to: a == null ? null : a.b<\/code><\/li>\r\n\r\n\r\n\r\n<li>\u5982\u679c\u8ba1\u7b97\u7ed3\u679c\u4e3a null\uff0c\u5219\u6b64\u793a\u4f8b\u8fd4\u56de null\u3002\u5982\u679c\u6ca1\u6709 \u8ba1\u7b97\u7ed3\u679c\u4e3a null \u5e76\u8fd4\u56de null\uff0c\u5219\u6b64\u8868\u8fbe\u5f0f\u5c06\u629b\u51fa\u4e00\u4e2a NullPointerException\u3002<samp>a[x]<\/samp><samp>a[x]<\/samp><samp>aMethod()<\/samp><code>a[x]?.aMethod().aField \/\/ Evaluates to null if a[x] == null<\/code><\/li>\r\n\r\n\r\n\r\n<li>\u5982\u679c\u8ba1\u7b97\u7ed3\u679c\u4e3a null\uff0c\u5219\u6b64\u793a\u4f8b\u8fd4\u56de null\u3002<samp>a[x].aMethod()<\/samp><code>a[x].aMethod()?.aField<\/code><\/li>\r\n\r\n\r\n\r\n<li>\u6b64\u793a\u4f8b\u6307\u793a\u8868\u8fbe\u5f0f\u7684\u7c7b\u578b\u662f\u5426\u76f8\u540c\uff0c\u65e0\u8bba \u5728\u8868\u8fbe\u5f0f\u4e2d\u4f7f\u7528\u5b89\u5168\u5bfc\u822a\u8fd0\u7b97\u7b26\uff0c\u6216\u8005 \u4e0d\u3002<code>Integer x = anObject?.anIntegerField; \/\/ The expression is of type Integer because the field is of type Integer<\/code><\/li>\r\n\r\n\r\n\r\n<li>\u6b64\u793a\u4f8b\u6f14\u793a\u4e00\u4e2a\u8bed\u53e5\uff0c\u8be5\u8bed\u53e5\u66ff\u6362\u4e86\u68c0\u67e5 null \u503c\u3002<code>\/\/ Previous code checking for nulls String profileUrl = null; if (user.getProfileUrl() != null) { profileUrl = user.getProfileUrl().toExternalForm(); }<\/code><code>\/\/ New code using the safe navigation operator String profileUrl = user.getProfileUrl()?.toExternalForm();<\/code><\/li>\r\n\r\n\r\n\r\n<li>\u6b64\u793a\u4f8b\u6f14\u793a\u4f7f\u7528\u5b89\u5168\u5bfc\u822a\u8fd0\u7b97\u7b26\u7684\u5355\u884c SOQL \u67e5\u8be2\u3002<code>\/\/ Previous code checking for nulls results = [SELECT Name FROM Account WHERE Id = :accId]; if (results.size() == 0) { \/\/ Account was deleted return null; } return results[0].Name;<\/code><code>\/\/ New code using the safe navigation operator return [SELECT Name FROM Account WHERE Id = :accId]?.Name;<\/code><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<figure class=\"wp-block-table\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<th>\u5141\u8bb8\u7684\u7528\u4f8b<\/th>\r\n<th>\u4f8b<\/th>\r\n<th>\u66f4\u591a\u4fe1\u606f<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>\u65b9\u6cd5\u3001\u53d8\u91cf\u6216\u53c2\u6570\u94fe<\/td>\r\n<td><samp>aObject?.aMethod();<\/samp><\/td>\r\n<td>\u53ef\u7528\u4f5c\u9876\u7ea7\u8bed\u53e5\u3002<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\u4f7f\u7528\u62ec\u53f7\uff0c\u4f8b\u5982\u5728\u5f3a\u5236\u8f6c\u6362\u4e2d\u3002<\/td>\r\n<td><samp>((T)a1?.b1)?.c1()<\/samp><\/td>\r\n<td>\u8fd0\u7b97\u7b26\u5c06\u65b9\u6cd5\u94fe\u8df3\u8fc7\u5230\u7b2c\u4e00\u6b21\u5173\u95ed \u62ec\u53f7\u3002\u901a\u8fc7\u5728\u62ec\u53f7\u540e\u6dfb\u52a0\u8fd0\u7b97\u7b26\uff0c\u4ee3\u7801 \u4fdd\u62a4\u6574\u4e2a\u8868\u8fbe\u5f0f\u3002\u5982\u679c\u8fd0\u7b97\u7b26\u5728\u5176\u4ed6\u5730\u65b9\u4f7f\u7528\uff0c \u800c\u4e0d\u662f\u5728\u62ec\u53f7\u4e4b\u540e\uff0c\u6574\u4e2a\u5f3a\u5236\u8f6c\u6362\u8868\u8fbe\u5f0f\u4e0d\u662f be \u4fdd\u969c\u3002\u4f8b\u5982\uff0c\u884c\u4e3a<code>\/\/Incorrect use of safe navigation operator ((T)a1?.b1).c1()<\/code>\u76f8\u5f53\u4e8e\uff1a<code>T ref = null; if (a1 != null) { ref = (T)a1.b1; } result = ref.c1();<\/code><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>SObject \u94fe\u63a5<\/td>\r\n<td><samp>String\u00a0s = contact.Account?.BillingCity;<\/samp><\/td>\r\n<td>\u5f53\u5173\u7cfb\u4e3a \u96f6\u3002\u8be5\u884c\u4e3a\u7b49\u6548\u4e8e \u3002<samp>String\u00a0s = contact.Account.BillingCity<\/samp><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>SOQL \u67e5\u8be2<\/td>\r\n<td><samp>String\u00a0s = [SELECT LastName FROM Contact]?.LastName;<\/samp><\/td>\r\n<td>\u5982\u679c SOQL \u67e5\u8be2\u672a\u8fd4\u56de\u4efb\u4f55\u5bf9\u8c61\uff0c\u5219\u8868\u8fbe\u5f0f \u8ba1\u7b97\u7ed3\u679c\u4e3a null\u3002\u8be5\u884c\u4e3a\u7b49\u6548\u4e8e\uff1a<code>List&lt;Contact&gt; contacts = [SELECT LastName FROM Contact]; String s; if (contacts.size() == 0) { s = null; \/\/ New behavior when using Safe Navigation. Earlier, this would throw an exception. } else if (contacts.size() == 1) { s = contacts.get(0).LastName; } else { \/\/ contacts.size() &gt; 1 throw new QueryException(...); }<\/code><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/figure>\r\n\r\n\r\n\r\n<p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u60a8\u4e0d\u80fd\u4f7f\u7528\u5b89\u5168\u5bfc\u822a\u8fd0\u7b97\u7b26\u3002\u5c1d\u8bd5\u4f7f\u7528 \u8fd0\u7b97\u7b26\u5728\u7f16\u8bd1\u8fc7\u7a0b\u4e2d\u4f1a\u5bfc\u81f4\u9519\u8bef\uff1a<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>\u5e26\u70b9\u7684\u7c7b\u578b\u548c\u9759\u6001\u8868\u8fbe\u5f0f\u3002\u4f8b\u5982\uff1a\r\n<ul class=\"wp-block-list\">\r\n<li>\u547d\u540d\u7a7a\u95f4<\/li>\r\n\r\n\r\n\r\n<li>{\u547d\u540d\u7a7a\u95f4}\u3002{\u7c7b}<\/li>\r\n\r\n\r\n\r\n<li>\u89e6\u53d1\u5668.new<\/li>\r\n\r\n\r\n\r\n<li>Flow.interview\u3002{\u6d41\u540d\u79f0}<\/li>\r\n\r\n\r\n\r\n<li>{\u7c7b\u578b}.class<\/li>\r\n<\/ul>\r\n<\/li>\r\n\r\n\r\n\r\n<li>\u9759\u6001\u53d8\u91cf\u8bbf\u95ee\u3001\u65b9\u6cd5\u8c03\u7528\u548c\u8868\u8fbe\u5f0f\u3002\u4f8b\u5982\uff1a\r\n<ul class=\"wp-block-list\">\r\n<li><samp>AClass.AStaticMethodCall()<\/samp><\/li>\r\n\r\n\r\n\r\n<li><samp>AClass.AStaticVariable<\/samp><\/li>\r\n\r\n\r\n\r\n<li><samp>String.format(&#8216;{0}&#8217;,\u00a0&#8216;hello\u00a0world&#8217;)<\/samp><\/li>\r\n\r\n\r\n\r\n<li><samp>Page.{pageName}<\/samp><\/li>\r\n<\/ul>\r\n<\/li>\r\n\r\n\r\n\r\n<li>Assignable expressions. For example:\r\n<ul class=\"wp-block-list\">\r\n<li><samp>foo?.bar = 42;<\/samp><\/li>\r\n\r\n\r\n\r\n<li><samp>++foo?.bar;<\/samp><\/li>\r\n<\/ul>\r\n<\/li>\r\n\r\n\r\n\r\n<li>SOQL \u7ed1\u5b9a\u8868\u8fbe\u5f0f\u3002\u4e3a \u4f8b\uff1a<code>class X { public String query = 'xyz';} X x = new X(); List&lt;Account&gt; accounts = [SELECT Name FROM Account WHERE Name = :X?.query] List&lt;List&lt;SObject&gt;&gt; moreAccounts = [FIND :X?.query IN ALL FIELDS RETURNING Account(Name)];<\/code><\/li>\r\n\r\n\r\n\r\n<li>\u4f7f\u7528 SObject \u6807\u91cf \u9886\u57df\u3002\u4f8b\u5982\uff1a<samp>addError()<\/samp><code>Contact c; c.LastName?.addError('The field must have a value');<\/code>\u6ce8\u610f\u4f60 \u53ef\u4ee5\u5c06\u8fd0\u7b97\u7b26\u4e0e SObjects \u4e00\u8d77\u4f7f\u7528\uff0c\u5305\u62ec\u67e5\u627e\u548c\u4e3b\u4ece\u7ec6\u8282 \u9886\u57df\u3002<samp>addError()<\/samp><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h1 class=\"wp-block-heading\">\u8fd0\u7b97\u7b26\u4f18\u5148\u7ea7<\/h1>\r\n\r\n\r\n\r\n<p>\u8fd0\u7b97\u7b26\u6839\u636e\u89c4\u5219\u6309\u987a\u5e8f\u89e3\u91ca\u3002<\/p>\r\n\r\n\r\n\r\n<p>Apex \u4f7f\u7528\u4ee5\u4e0b\u8fd0\u7b97\u7b26\u4f18\u5148\u7ea7\u89c4\u5219\uff1a<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-table\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<th>\u4f18\u5148<\/th>\r\n<th>\u8fd0\u8425\u5546<\/th>\r\n<th>\u63cf\u8ff0<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>1<\/td>\r\n<td><samp>{} () ++ &#8212;<\/samp><\/td>\r\n<td>\u5206\u7ec4\u548c\u524d\u7f00\u9012\u589e\u548c\u9012\u51cf<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>2<\/td>\r\n<td><samp>~ ! -x +x (type)\u00a0new<\/samp><\/td>\r\n<td>\u4e00\u5143\u8fd0\u7b97\u7b26\u3001\u52a0\u6cd5\u8fd0\u7b97\u7b26\u3001\u7c7b\u578b\u8f6c\u6362\u548c\u5bf9\u8c61 \u521b\u9020<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>3<\/td>\r\n<td><samp>* \/<\/samp><\/td>\r\n<td>\u4e58\u6cd5\u548c\u9664\u6cd5<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>4<\/td>\r\n<td><samp>+ &#8211;<\/samp><\/td>\r\n<td>\u52a0\u6cd5\u548c\u51cf\u6cd5<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>5<\/td>\r\n<td><samp>&lt;&lt; &gt;&gt; &gt;&gt;&gt;<\/samp><\/td>\r\n<td>\u8f6e\u73ed\u64cd\u4f5c\u5458<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>6<\/td>\r\n<td><samp>&lt; &lt;= &gt; &gt;=\u00a0instanceof<\/samp><\/td>\r\n<td>\u5927\u4e8e\u548c\u5c0f\u4e8e\u6bd4\u8f83\u3001\u53c2\u8003\u6d4b\u8bd5<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>7<\/td>\r\n<td><samp>== !=<\/samp><\/td>\r\n<td>\u6bd4\u8f83\uff1a\u76f8\u7b49\u548c\u4e0d\u76f8\u7b49<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>8<\/td>\r\n<td><samp>&amp;<\/samp><\/td>\r\n<td>\u6309\u4f4d AND<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>9<\/td>\r\n<td><samp>^<\/samp><\/td>\r\n<td>\u6309\u4f4d\u5f02\u6216<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>10<\/td>\r\n<td><samp>|<\/samp><\/td>\r\n<td>\u6309\u4f4d OR<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>11<\/td>\r\n<td><samp>&amp;&amp;<\/samp><\/td>\r\n<td>\u903b\u8f91 AND<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>12<\/td>\r\n<td><samp>||<\/samp><\/td>\r\n<td>\u903b\u8f91 OR<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>13<\/td>\r\n<td><samp>= += -= *= \/= &amp;= &lt;&lt;= &gt;&gt;= &gt;&gt;&gt;=<\/samp><\/td>\r\n<td>\u8d4b<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/figure>\r\n\r\n\r\n\r\n<h1 class=\"wp-block-heading\">\u6ce8\u91ca<\/h1>\r\n\r\n\r\n\r\n<p>Apex \u4ee3\u7801\u652f\u6301\u5355\u884c\u548c\u591a\u884c\u6ce8\u91ca\u3002<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>\u8981\u521b\u5efa\u5355\u884c\u6ce8\u91ca\uff0c\u8bf7\u4f7f\u7528 . \u89e3\u6790\u5668\u5c06\u5ffd\u7565 \u53f3\u4fa7\u540c\u4e00\u884c\u4e0a\u7684\u6240\u6709\u5b57\u7b26\u3002\u4e3a \u4f8b\uff1a<samp>\/\/<\/samp><samp>\/\/<\/samp><code>Integer i = 1; \/\/ This comment is ignored by the parser<\/code><\/li>\r\n\r\n\r\n\r\n<li>\u82e5\u8981\u521b\u5efa\u591a\u884c\u6ce8\u91ca\uff0c\u8bf7\u4f7f\u7528 \u548c \u6765\u5206\u9694\u5f00\u5934\u548c\u7ed3\u5c3e \u7684\u8bc4\u8bba\u5757\u3002\u4e3a \u4f8b\uff1a<samp>\/*<\/samp><samp>*\/<\/samp><code>Integer i = 1; \/* This comment can wrap over multiple lines without getting interpreted by the parser. *\/<\/code><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h1 class=\"wp-block-heading\">\u8d4b\u503c\u8bed\u53e5<\/h1>\r\n\r\n\r\n\r\n<p>\u8d4b\u503c\u8bed\u53e5\u662f\u5c06\u503c\u653e\u5165 \u53d8\u91cf\u3002\u8d4b\u503c\u8bed\u53e5\u901a\u5e38\u91c7\u7528\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\u4e4b\u4e00 \u5f62\u5f0f\uff1a<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>[LValue] = [new_value_expression];\r\n[LValue] = [[inline_soql_query]];<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u5728\u4e0a\u9762\u7684\u8868\u683c\u4e2d\uff0c\u4ee3\u8868\u4efb\u4f55 \u53ef\u4ee5\u653e\u7f6e\u5728\u8d4b\u503c\u8fd0\u7b97\u7b26\u5de6\u4fa7\u7684\u8868\u8fbe\u5f0f\u3002\u8fd9\u4e9b\u5305\u62ec\uff1a<\/p>\r\n\r\n\r\n\r\n<p><samp>[LValue]<\/samp><\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>\u4e00\u4e2a\u7b80\u5355\u7684\u53d8\u91cf\u3002\u4e3a \u4f8b\uff1a<code>Integer i = 1; Account a = new Account(); Account[] accts = [SELECT Id FROM Account];<\/code><\/li>\r\n\r\n\r\n\r\n<li>\u53d6\u6d88\u5f15\u7528\u7684\u5217\u8868\u5143\u7d20\u3002\u4e3a \u4f8b\uff1a<code>ints[0] = 1; accts[0].Name = 'Acme';<\/code><\/li>\r\n\r\n\r\n\r\n<li>\u4e0a\u4e0b\u6587\u7528\u6237\u6709\u6743\u7f16\u8f91\u7684 sObject \u5b57\u6bb5\u5f15\u7528\u3002\u4e3a \u4f8b\uff1a<code>Account a = new Account(Name = 'Acme', BillingCity = 'San Francisco'); \/\/ IDs cannot be set prior to an insert call \/\/ a.Id = '00300000003T2PGAA0'; \/\/ Instead, insert the record. The system automatically assigns it an ID. insert a; \/\/ Fields also must be writable for the context user \/\/ a.CreatedDate = System.today(); This code is invalid because \/\/ createdDate is read-only! \/\/ Since the account a has been inserted, it is now possible to \/\/ create a new contact that is related to it Contact c = new Contact(LastName = 'Roth', Account = a); \/\/ Notice that you can write to the account name directly through the contact c.Account.Name = 'salesforce.com';<\/code><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>\u8d4b\u503c\u59cb\u7ec8\u901a\u8fc7\u5f15\u7528\u5b8c\u6210\u3002\u4e3a \u4f8b\uff1a<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>Account a = new Account();\r\nAccount b;\r\nAccount[] c = new Account[]{};\r\na.Name = 'Acme';\r\nb = a;         \r\nc.add(a);      \r\n\r\n\/\/ These asserts should now be true. You can reference the data\r\n\/\/ originally allocated to account a through account b and account list c.\r\nSystem.assertEquals(b.Name, 'Acme');          \r\nSystem.assertEquals(c[0].Name, 'Acme');<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u540c\u6837\uff0c\u4e24\u4e2a\u5217\u8868\u53ef\u4ee5\u6307\u5411\u5185\u5b58\u4e2d\u7684\u76f8\u540c\u503c\u3002\u4e3a \u4f8b\uff1a<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>Account[] a = new Account[]{new Account()};\r\nAccount[] b = a;\r\na[0].Name = 'Acme';\r\nSystem.assert(b[0].Name == 'Acme');<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u9664\u4e86 \u4e4b\u5916\uff0c\u5176\u4ed6\u6709\u6548\u5206\u914d \u8fd0\u7b97\u7b26\u5305\u62ec \u3001 \u3001 \u3001 \u3001 \u548c \u3002\u8bf7\u53c2\u9605<a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.apexcode.meta\/apexcode\/langCon_apex_expressions_operators_understanding.htm\">\u8868\u8fbe\u5f0f \u8fd0\u7b97\u7b26<\/a>\u3002<samp>=<\/samp><samp>+=<\/samp><samp>*=<\/samp><samp>\/=<\/samp><samp>|=<\/samp><samp>&amp;=<\/samp><samp>++<\/samp><samp>&#8212;<\/samp><\/p>\r\n\r\n\r\n\r\n<h1 class=\"wp-block-heading\">\u8f6c\u6362\u89c4\u5219<\/h1>\r\n\r\n\r\n\r\n<p>\u901a\u5e38\uff0cApex \u8981\u6c42\u60a8\u663e\u5f0f\u5c06\u4e00\u79cd\u6570\u636e\u7c7b\u578b\u8f6c\u6362\u4e3a\u53e6\u4e00\u79cd\u6570\u636e\u7c7b\u578b\u3002\u4e3a \u4f8b\u5982\uff0cInteger \u6570\u636e\u7c7b\u578b\u7684\u53d8\u91cf\u4e0d\u80fd\u9690\u5f0f\u8f6c\u6362\u4e3a String\u3002\u4f60 \u5fc5\u987b\u4f7f\u7528\u8be5\u65b9\u6cd5\u3002\u4f46\u662f\uff0c\u4e00\u4e9b \u6570\u636e\u7c7b\u578b\u53ef\u4ee5\u9690\u5f0f\u8f6c\u6362\uff0c\u800c\u65e0\u9700\u4f7f\u7528\u65b9\u6cd5\u3002<\/p>\r\n\r\n\r\n\r\n<p><samp>string.format<\/samp>\u6570\u5b57\u5f62\u6210\u7c7b\u578b\u7684\u5c42\u6b21\u7ed3\u6784\u3002\u8f83\u4f4e\u6570\u503c\u7c7b\u578b\u7684\u53d8\u91cf\u59cb\u7ec8\u53ef\u4ee5\u662f \u5206\u914d\u7ed9\u66f4\u9ad8\u7684\u7c7b\u578b\uff0c\u800c\u4e0d\u8fdb\u884c\u663e\u5f0f\u8f6c\u6362\u3002\u4ee5\u4e0b\u662f \u6570\u5b57\uff0c\u4ece\u4f4e\u5230\u9ad8\uff1a<\/p>\r\n\r\n\r\n\r\n<ol class=\"wp-block-list\">\r\n<li>\u6574\u6570<\/li>\r\n\r\n\r\n\r\n<li>\u957f<\/li>\r\n\r\n\r\n\r\n<li>\u53cc<\/li>\r\n\r\n\r\n\r\n<li>\u5341\u8fdb\u5236<\/li>\r\n<\/ol>\r\n\r\n\r\n\r\n<p>\u6ce8\u610f<\/p>\r\n\r\n\r\n\r\n<p>\u4e00\u65e6\u5c06\u503c\u4ece\u8f83\u4f4e\u7c7b\u578b\u7684\u6570\u5b57\u4f20\u9012\u5230\u8f83\u9ad8\u7c7b\u578b\u7684\u6570\u5b57 type\uff0c\u5219\u8be5\u503c\u5c06\u8f6c\u6362\u4e3a\u66f4\u9ad8\u7c7b\u578b\u7684\u6570\u5b57\u3002<\/p>\r\n\r\n\r\n\r\n<p>\u8bf7\u6ce8\u610f\uff0c\u5c42\u6b21\u7ed3\u6784\u548c\u9690\u5f0f\u8f6c\u6362\u4e0e\u6570\u5b57\u7684 Java \u5c42\u6b21\u7ed3\u6784\u4e0d\u540c\uff0c \u5176\u4e2d\u4f7f\u7528\u57fa\u672c\u63a5\u53e3\u53f7\uff0c\u5e76\u4e14\u4ece\u4e0d\u8fdb\u884c\u9690\u5f0f\u5bf9\u8c61\u8f6c\u6362 \u5141\u8bb8\u3002\u9664\u6570\u5b57\u5916\uff0c\u8fd8\u53ef\u4ee5\u9690\u5f0f\u8f6c\u6362\u5176\u4ed6\u6570\u636e\u7c7b\u578b\u3002\u4ee5\u4e0b\u89c4\u5219\u9002\u7528\uff1a<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>ID \u59cb\u7ec8\u53ef\u4ee5\u5206\u914d\u7ed9\u5b57\u7b26\u4e32\u3002<\/li>\r\n\r\n\r\n\r\n<li>\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u5206\u914d\u7ed9 ID\u3002\u4f46\u662f\uff0c\u5728\u8fd0\u884c\u65f6\uff0c\u8be5\u503c\u5c06\u68c0\u67e5\u4e3a \u786e\u4fdd\u5b83\u662f\u5408\u6cd5\u7684 ID\u3002\u5982\u679c\u4e0d\u662f\uff0c\u5219\u8fd0\u884c\u65f6\u5f02\u5e38\u662f \u6254\u3002<\/li>\r\n\r\n\r\n\r\n<li>\u5173\u952e\u5b57\u59cb\u7ec8\u53ef\u4ee5\u662f \u7528\u4e8e\u6d4b\u8bd5\u5b57\u7b26\u4e32\u662f\u5426\u4e3a ID\u3002<samp>instanceOf<\/samp><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">\u6570\u636e\u7c7b\u578b\u7684\u5176\u4ed6\u6ce8\u610f\u4e8b\u9879<\/h2>\r\n\r\n\r\n\r\n<p>\u6570\u503c\u7684\u6570\u636e\u7c7b\u578b\u6570\u503c\u8868\u793a\u6574\u6570\u503c\uff0c\u9664\u975e\u5b83\u4eec\u9644\u52a0\u4e86 L a Long \u6216 .0 \u8868\u793a\u53cc\u7cbe\u5ea6\u6216\u5c0f\u6570\u3002\u4f8b\u5982\uff0c\u8868\u8fbe\u5f0f\u58f0\u660e\u4e00\u4e2a Long \u540d\u4e3a d \u7684\u53d8\u91cf\u5e76\u5c06\u5176\u8d4b\u503c\u7ed9\u4e00\u4e2a\u6574\u6570\u6570\u503c \uff08123\uff09\uff0c\u5373 \u9690\u5f0f\u8f6c\u6362\u4e3a Long\u3002\u53f3\u4fa7\u7684\u6574\u6570\u503c\u4e3a \u5728\u6574\u6570\u8303\u56f4\u5185\uff0c\u8d4b\u503c\u6210\u529f\u3002\u4f46\u662f\uff0c\u5982\u679c \u53f3\u4fa7\u7684\u6570\u503c\u8d85\u51fa\u4e86 \u6574\u6570\uff0c\u5219\u4f1a\u51fa\u73b0\u7f16\u8bd1\u9519\u8bef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u89e3\u51b3\u65b9\u6848\u662f \u5c06 L \u8ffd\u52a0\u5230\u6570\u503c\uff0c\u4ee5\u4fbf\u5b83\u8868\u793a\u5177\u6709 \u8303\u56f4\u66f4\u5e7f\uff0c\u5982\u4ee5\u4e0b\u793a\u4f8b\u6240\u793a\uff1a\u3002<samp>Long\u00a0d = 123;<\/samp><samp>Long\u00a0d = 2147483648L;<\/samp>\u6570\u636e\u7c7b\u578b\u503c\u6ea2\u51fa\u4ea7\u751f\u5927\u4e8e\u6700\u5927\u503c\u7684\u7b97\u672f\u8ba1\u7b97 \u7535\u6d41\u7c7b\u578b\u88ab\u79f0\u4e3a\u6ea2\u51fa\u3002\u4f8b\u5982\uff0c\u4ea7\u751f\u4e00\u4e2a \u503c\u4e3a \u20132147483648\uff0c\u56e0\u4e3a 2147483647 \u662f \u6574\u6570\uff0c\u56e0\u6b64\u5411\u5176\u6dfb\u52a0 1 \u4f1a\u5c06\u503c\u5305\u88c5\u5230\u6700\u5c0f\u7684\u8d1f\u6570 \u6574\u6570\u7684\u503c\u4e3a \u20132147483648\u3002<samp>Integer\u00a0i = 2147483647 + 1;<\/samp>\u5982\u679c\u7b97\u672f\u8ba1\u7b97\u751f\u6210\u7684\u7ed3\u679c\u5927\u4e8e\u6700\u5927\u503c \u5bf9\u4e8e\u5f53\u524d\u7c7b\u578b\uff0c\u6700\u7ec8\u7ed3\u679c\u5c06\u4e0d\u6b63\u786e\uff0c\u56e0\u4e3a\u8ba1\u7b97\u51fa\u7684 \u5927\u4e8e\u6700\u5927\u503c\u7684\u503c\u5c06\u6ea2\u51fa\u3002\u4f8b\u5982\uff0c \u8868\u8fbe\u5f0f\u4f1a\u5bfc\u81f4\u4e0d\u6b63\u786e\u7684\u7ed3\u679c\uff0c\u56e0\u4e3a \u53f3\u4fa7\u6574\u6570\u7684\u4e58\u79ef\u5927\u4e8e\u6700\u5927\u503c \u6574\u6570\u503c\uff0c\u5b83\u4eec\u4f1a\u6ea2\u51fa\u3002\u56e0\u6b64\uff0c\u6700\u7ec8\u4ea7\u54c1\u4e0d\u662f \u671f\u5f85\u4e00\u4e2a\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u786e\u4fdd\u6570\u503c\u7684\u7c7b\u578b\u6765\u907f\u514d\u8fd9\u79cd\u60c5\u51b5 \u6216\u8005\u60a8\u5728\u7b97\u672f\u8fd0\u7b97\u4e2d\u4f7f\u7528\u7684\u53d8\u91cf\u8db3\u591f\u5927\uff0c\u53ef\u4ee5\u5bb9\u7eb3 \u7ed3\u679c\u3002\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u5c06 L \u8ffd\u52a0\u5230\u6570\u503c\u4ee5\u4f7f\u5176\u6210\u4e3a Long \u6240\u4ee5\u4e2d\u95f4\u4ea7\u54c1\u4e5f\u4f1a\u5f88\u957f\uff0c\u4e0d\u4f1a\u53d1\u751f\u6ea2\u51fa\u3002 \u4ee5\u4e0b\u793a\u4f8b\u6f14\u793a\u5982\u4f55\u6b63\u786e\u8ba1\u7b97 \u4e00\u5e74\u4e2d\u7684\u6beb\u79d2\u4e58\u4ee5\u957f\u6570\u5b57 \u503c\u3002<samp>Long\u00a0MillsPerYear = 365 * 24 * 60 * 60 * 1000;<\/samp><\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>Long MillsPerYear = 365L * 24L * 60L * 60L * 1000L;\r\nLong ExpectedValue = 31536000000L;\r\nSystem.assertEquals(MillsPerYear, ExpectedValue);<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u5206\u90e8\u5206\u6570\u635f\u5931\u5c06\u6570\u503c Integer \u6216 Long \u503c\u76f8\u9664\u65f6\uff0c\u5c06 \u7ed3\u679c\uff08\u5982\u679c\u6709\uff09\u5728\u6267\u884c\u4efb\u4f55\u9690\u5f0f\u8f6c\u6362\u4e3a \u53cc\u7cbe\u5ea6\u6216\u5341\u8fdb\u5236\u3002\u4f8b\u5982\uff0c\u8fd4\u56de 1.0\uff0c\u56e0\u4e3a\u5b9e\u9645\u7ed3\u679c \uff081.666&#8230;\uff09 \u662f \u6574\u6570\uff0c\u5728\u9690\u5f0f\u8f6c\u6362\u4e3a Double \u4e4b\u524d\u56db\u820d\u4e94\u5165\u4e3a 1\u3002 \u8981\u4fdd\u7559\u5c0f\u6570\u503c\uff0c\u8bf7\u786e\u4fdd\u4f7f\u7528 Double \u6216 \u9664\u6cd5\u4e2d\u7684\u5341\u8fdb\u5236\u6570\u503c\u3002\u4f8b\u5982\uff0c\u8fd4\u56de 1.66666666666666667\uff0c\u56e0\u4e3a 5.0 \u548c 3.0 \u8868\u793a Double \u503c\uff0c\u5176\u4e2d \u7ed3\u679c\u5546\u4e5f\u662f\u53cc\u7cbe\u5ea6\uff0c\u6ca1\u6709\u5c0f\u6570\u503c\u662f \u5931\u53bb\u3002<samp>Double\u00a0d = 5\/3;<\/samp><samp>Double\u00a0d = 5.0\/3.0;<\/samp><\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>\u8868\u8fbe\u5f0f\u662f\u7531\u53d8\u91cf\u3001\u8fd0\u7b97\u7b26\u548c\u65b9\u6cd5\u8c03\u7528\u7ec4\u6210\u7684\u6784\u9020\uff0c\u8fd9\u4e9b\u53d8\u91cf\u3001\u8fd0\u7b97\u7b26\u548c\u65b9\u6cd5\u8c03\u7528 \u8ba1\u7b97\u7ed3\u679c\u4e3a\u5355\u4e2a\u503c\u3002 \u8868\u8fbe\u5f0f \u8868\u8fbe\u5f0f\u662f\u7531 &hellip; <a href=\"http:\/\/www.ponybai.com\/?p=3619\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Apex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[199],"tags":[],"class_list":["post-3619","post","type-post","status-publish","format-standard","hentry","category-apex-"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Apex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26 - \u767d\u767d\u968f\u7b14<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.ponybai.com\/?p=3619\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Apex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26 - \u767d\u767d\u968f\u7b14\" \/>\n<meta property=\"og:description\" content=\"\u8868\u8fbe\u5f0f\u662f\u7531\u53d8\u91cf\u3001\u8fd0\u7b97\u7b26\u548c\u65b9\u6cd5\u8c03\u7528\u7ec4\u6210\u7684\u6784\u9020\uff0c\u8fd9\u4e9b\u53d8\u91cf\u3001\u8fd0\u7b97\u7b26\u548c\u65b9\u6cd5\u8c03\u7528 \u8ba1\u7b97\u7ed3\u679c\u4e3a\u5355\u4e2a\u503c\u3002 \u8868\u8fbe\u5f0f \u8868\u8fbe\u5f0f\u662f\u7531 &hellip; \u7ee7\u7eed\u9605\u8bfbApex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.ponybai.com\/?p=3619\" \/>\n<meta property=\"og:site_name\" content=\"\u767d\u767d\u968f\u7b14\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-20T13:33:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-20T13:40:30+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/11\/cropped-weixin2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"248\" \/>\n\t<meta property=\"og:image:height\" content=\"248\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"ponybai\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"ponybai\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/www.ponybai.com\/?p=3619#article\",\"isPartOf\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=3619\"},\"author\":{\"name\":\"ponybai\",\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"headline\":\"Apex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26\",\"datePublished\":\"2023-11-20T13:33:30+00:00\",\"dateModified\":\"2023-11-20T13:40:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=3619\"},\"wordCount\":730,\"publisher\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"articleSection\":[\"Apex \u5f00\u53d1\u4eba\u5458\u6307\u5357\"],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.ponybai.com\/?p=3619\",\"url\":\"http:\/\/www.ponybai.com\/?p=3619\",\"name\":\"Apex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26 - \u767d\u767d\u968f\u7b14\",\"isPartOf\":{\"@id\":\"http:\/\/www.ponybai.com\/#website\"},\"datePublished\":\"2023-11-20T13:33:30+00:00\",\"dateModified\":\"2023-11-20T13:40:30+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=3619#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.ponybai.com\/?p=3619\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.ponybai.com\/?p=3619#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/www.ponybai.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Apex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.ponybai.com\/#website\",\"url\":\"http:\/\/www.ponybai.com\/\",\"name\":\"\u767d\u767d\u968f\u7b14\",\"description\":\"Salesforce\u5b98\u65b9\u8bb2\u5e08\",\"publisher\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.ponybai.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\",\"name\":\"ponybai\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg\",\"contentUrl\":\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg\",\"width\":248,\"height\":248,\"caption\":\"ponybai\"},\"logo\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/121.37.188.161\"],\"url\":\"http:\/\/www.ponybai.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Apex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26 - \u767d\u767d\u968f\u7b14","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":"http:\/\/www.ponybai.com\/?p=3619","og_locale":"zh_CN","og_type":"article","og_title":"Apex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26 - \u767d\u767d\u968f\u7b14","og_description":"\u8868\u8fbe\u5f0f\u662f\u7531\u53d8\u91cf\u3001\u8fd0\u7b97\u7b26\u548c\u65b9\u6cd5\u8c03\u7528\u7ec4\u6210\u7684\u6784\u9020\uff0c\u8fd9\u4e9b\u53d8\u91cf\u3001\u8fd0\u7b97\u7b26\u548c\u65b9\u6cd5\u8c03\u7528 \u8ba1\u7b97\u7ed3\u679c\u4e3a\u5355\u4e2a\u503c\u3002 \u8868\u8fbe\u5f0f \u8868\u8fbe\u5f0f\u662f\u7531 &hellip; \u7ee7\u7eed\u9605\u8bfbApex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26","og_url":"http:\/\/www.ponybai.com\/?p=3619","og_site_name":"\u767d\u767d\u968f\u7b14","article_published_time":"2023-11-20T13:33:30+00:00","article_modified_time":"2023-11-20T13:40:30+00:00","og_image":[{"width":248,"height":248,"url":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/11\/cropped-weixin2.jpg","type":"image\/jpeg"}],"author":"ponybai","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"ponybai","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.ponybai.com\/?p=3619#article","isPartOf":{"@id":"http:\/\/www.ponybai.com\/?p=3619"},"author":{"name":"ponybai","@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"headline":"Apex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26","datePublished":"2023-11-20T13:33:30+00:00","dateModified":"2023-11-20T13:40:30+00:00","mainEntityOfPage":{"@id":"http:\/\/www.ponybai.com\/?p=3619"},"wordCount":730,"publisher":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"articleSection":["Apex \u5f00\u53d1\u4eba\u5458\u6307\u5357"],"inLanguage":"zh-Hans"},{"@type":"WebPage","@id":"http:\/\/www.ponybai.com\/?p=3619","url":"http:\/\/www.ponybai.com\/?p=3619","name":"Apex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26 - \u767d\u767d\u968f\u7b14","isPartOf":{"@id":"http:\/\/www.ponybai.com\/#website"},"datePublished":"2023-11-20T13:33:30+00:00","dateModified":"2023-11-20T13:40:30+00:00","breadcrumb":{"@id":"http:\/\/www.ponybai.com\/?p=3619#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.ponybai.com\/?p=3619"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.ponybai.com\/?p=3619#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/www.ponybai.com\/"},{"@type":"ListItem","position":2,"name":"Apex\u8868\u8fbe\u5f0f\u548c\u8fd0\u7b97\u7b26"}]},{"@type":"WebSite","@id":"http:\/\/www.ponybai.com\/#website","url":"http:\/\/www.ponybai.com\/","name":"\u767d\u767d\u968f\u7b14","description":"Salesforce\u5b98\u65b9\u8bb2\u5e08","publisher":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.ponybai.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883","name":"ponybai","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/","url":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg","contentUrl":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg","width":248,"height":248,"caption":"ponybai"},"logo":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/121.37.188.161"],"url":"http:\/\/www.ponybai.com\/?author=1"}]}},"_links":{"self":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/3619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3619"}],"version-history":[{"count":3,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/3619\/revisions"}],"predecessor-version":[{"id":3622,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/3619\/revisions\/3622"}],"wp:attachment":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3619"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}