【发布时间】:2018-04-10 08:07:28
【问题描述】:
请告诉我为什么我不能将这些元素添加到列表中。请在附件screenshot 中查找错误。
public class PracticeOnLists {
List<String> myList = new List<String>();
myList.add('element1');
myList.add('element2');
myList.add('element3');
myList.add('element4');
System.debug('The List is' + myList);
System.debug('The size o the List is ' + myList.size());
}
【问题讨论】:
-
单引号改为双引号
myList.add("element1"); -
单引号用于字符,例如'a' 'b' '#'。字符串的双引号,说“我是一个字符串”
-
有待编辑。查看并接受它。并说明问题是关于 Java 还是 Apex
标签: list collections salesforce apex