You need to sign in to do that
Don't have an account?
Brian Oconnell
Constructors cannot be static
Doing Trailhead exercise here: https://developer.salesforce.com/en/trailhead/force_com_programmatic_beginner/apex_database/apex_database_intro
This is my code:
Thank you,
Brian
This is my code:
public class StringArrayTest { public static generateStringArray(Integer x) { List<String> stringList = new List<String>(); for (integer n=0; n<x; n++) { stringList.add('Test '+n); } return stringList; } }I get the error message "Constructors cannot be static" on line 2, but I can not find anywhere an example of a public static method that returns a value. How can I fix this?
Thank you,
Brian
All Answers
I surely hope you didn't use '<b>List<String></b>' as the return type.