Thanks,
public class ContactReclassTest {
String confirstName;
String conlastName;
List<Contact> conList = New List<Contact>(); // this should be seen by within all methods yes?
ContactReclassTest() {
conFirstName = 'Mathew';
conlastName = 'Andresen';
}
public static void createContacts() {
List<Contact> conList = New List<Contact>(); // If I don't put this in it says the variable doesn't exist
for(Integer i = 0; i < 5; i++) {
Contact con = new Contact(FirstName = 'Mathew', LastName = ('Andresen'+ i) ); //can't find the other strings I declared either
conList.add(con);
}
insert(conList);
}
}
2 answers
You are trying to reference the member variable from a static method. This can not be done. You have to make variable static as well to access it.