Developers comfortable with Array notation can also use it while using Lists. Array and List syntax can be used interchangeably. Array notation is a notation where a list’s elements are referenced by enclosing the index number in square brackets after the list’s name.
String nameList = new String;
String nameList2 = new List<String>();
List<String> nameList3 = new String;
// Set values for 0, 1, 2 indices
nameList = ‘Bhavna’;
nameList = ‘Bhavya’;
nameList = ‘Swati’;
// Size of the list, which is always an integer value
Integer listSize = nameList.size();
// Accessing the 2nd element in the list, denoted by index 1
System.debug(nameList); // ‘Bhavna’
Some common methods of list:
< < Previous
Next > >
The batch is going to start shortly. Fill the form given below to Register yourself now.
Fill the form below to get a demo of this course.
Online Salesforce Development Course is soon going to be launched. Please fill the form and we will notify you about the course.