List<Account> listsample = [Select Id,Name from Account limit 5]; system.debug('The Account Name at index 0 is'+listsample[0].Name); system.debug('The size of the list is'+listsample.size()); //Adding a element to the list listsample.add(new Account(Name='testlistsample')); system.debug('The size of the list now is'+listsample.size()); //Remove a element from the list listsample.remove(5); system.debug('The size of the list now is'+listsample.size());