课程表

Apex课程

工具箱
速查手册

Apex - 数组

当前位置:免费教程 » 程序设计 » Apex

在Apex数组是基本相同的Apex列表。有作为其内部数据结构中的数组和列表之间没有逻辑的区别和方法也相同,但数组的语法是传统的小像Java。

下面是产品的Array的表示:
指数0 - HCL
指数1 - H2SO4
索引2 - NACL
指数3 - H2O
指数4 - N2
指数5 - U296

句法:

  1. <String> [] = arrayOfProducts The new List <String> ();

例:

假设,我们想存储我们的产品名称,然后我们可以使用中,我们可以存储的产品名称如下图所示的阵列。可以通过指定索引访问特定产品。

  1. // Define an array
  2. String [] = arrayOfProducts The new List <String> ();
  3. // The added array element
  4. ArrayOfProducts.add ('HCL');
  5. ArrayOfProducts.add ('H2SO4');
  6. ArrayOfProducts.add ('NACL');
  7. ArrayOfProducts.add ('water');
  8. ArrayOfProducts.add ("N2");
  9. ArrayOfProducts.add ('U296');
  10.  
  11.  
  12. For the (integer i = 0; I <arrayOfProducts.size (); my ++) {
  13.      // This loop prints all the elements of the array
  14.      System.debug (array of values: '+ arrayOfProducts [I]);
  15. }}

通过使用索引访问数组元素:

你可以通过使用索引来访问任何元素的数组,如下所示:

  1. // Access the elements in the array
  2. // We will access the element at index 3
  3. System.debug ('in exponent 3 has the value:' + arrayOfProducts [3]);
转载本站内容时,请务必注明来自W3xue,违者必究。
 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号