List

List<Integer> myList = new List<integer>();
List<String> myFavBooks = new List<String>{'Book1','Book2','Book3'};
List<String> myFavDrinks = new List<String>();
List<Integer> myFavNumbers = new List<Integer>{1,2,33,444};
List<Boolean> myThoughts = new List<Boolean>{true,false};
Account accRec = new Account();
List<Account> accountrecords = new List<Account>{accRec};




  • List is a Collection of Elements
  • Collection of same type of elements.
  • List is always ordered
  • List can hold duplicate values
  • First index position is always 0