You need to sign in to do that
Don't have an account?
Louis Summers
Trailhead challenge to Create an Apex class
In the introduction to Apex, I was surprised that the challenge was such a leap for an introductory lesson, but I never back away from a challenge. I have attempted to create the class which requires much more knowledge than is presented. The method is to be public and static. But the complier message says that constructors cannot be static. I see no reason why my method should be interpreted to be a constructor. Can anyone suggest why this is happening. I'm a Newbie, so it could be a simple correction, but I have done some extensive research before asking for assistance. Thanks in advance.
Task "Create an Apex class that returns an array (or list) of strings"
Task "Create an Apex class that returns an array (or list) of strings"
MyMethod would be interpreted as a constructor as it doesn't have a return type. If the method is not intended to return a result, it should define the return type 'void':
Doesn't define a return value, so the compiler assumes its a constructor. As your method is going to return an array (or list) of strings, you need to declare that: