• Fayazuddin Mohammed
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hello, Can anyone please tell me what's wrong with my code. When I run it executes fine and o/p also seems to be correct. Howeve the trailhead challenge shows error "Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings."

public class StringArrayTest {
    public static List <String> generateStringArray(Integer n) {
        List<String> numbers = new List<String>();
        
        for (integer i=0;i<=n; i++){
              numbers.add('Test '+String.valueOf(i));
            System.debug(numbers[i]);            
                }
        return numbers;
    }
}
Hello, Can anyone please tell me what's wrong with my code. When I run it executes fine and o/p also seems to be correct. Howeve the trailhead challenge shows error "Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings."

public class StringArrayTest {
    public static List <String> generateStringArray(Integer n) {
        List<String> numbers = new List<String>();
        
        for (integer i=0;i<=n; i++){
              numbers.add('Test '+String.valueOf(i));
            System.debug(numbers[i]);            
                }
        return numbers;
    }
}
I keep getting this error from the challenge.  I logged into my developer console from the Trailhead challenge screen using same email address (only have one on Salesforce.com) and nothing has changed since I started the developer track on Trailhead, which requires numerous challenges.

The Apex class named StringArrayTest shows up on the development console and from the setup interface in the developer section....

I am puzzled how it can show up on both and after entering from the trailhead challenge logon to developer edition and still have this error that is is not  found.  Any suggestion????