I have been studying Salesforce Dev for the past few weeks and can't find any documentation on something very simple. Can anyone explain why I would make the public static method a type of list rather then just having the list inside of the method? Why wouldn't I simply have the list inside of a non-list method and then when I call 'return', the method will return a list.
public class ContactAndLeadSearch {
public static List<List<SObject>> searchContactsAndLeads(String a) {
list<list<sObject>> stringy = [find :a IN ALL FIELDS Returning lead(FirstName, LastName), contact(firstname, lastname)];
return stringy;
}
}