You need to sign in to do that
Don't have an account?
fiona gentry
Why getting Static method cannot be referenced from a non static context: List<String> From Execute Anonymous Code
Hi,
Below is apex code which i am terying to execue in "Open Execute Anonymous Window"
Here is Apex class
Can anyone help why i am getting this error as My method is static and arrays can be returned from static
Regards,
Fiona
Below is apex code which i am terying to execue in "Open Execute Anonymous Window"
SDSAfterConvert n1 = new SDSAfterConvert(); n1.returnInteger();
Here is Apex class
public class SDSAfterConvert { public static List<String> returnInteger(){ List<String> inputList = new List<String>(); String[] myAlphabets = new String[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'g'}; for (String s1 : myAlphabets) { System.debug(s1); inputList.add(s1); } return inputList; } }
Can anyone help why i am getting this error as My method is static and arrays can be returned from static
Regards,
Fiona
2. Please use the below code to call a static method from Execute Anonymous Window
SDSAfterConvert.returnInteger();
Tks,
Shatrughna