You need to sign in to do that
Don't have an account?
Pradeep Joshi 7
Method does not exist or incorrect signature: void generateStringArray(Integer) from the type StringArrayTest
Hi,
i am getting error while solving trailhead challange. please find below error.
"Method does not exist or incorrect signature: void generateStringArray(Integer) from the type StringArrayTest"
I tried some code given as best answers.
1. First Code I tried
public class StringArrayTest
{
public static List<String> generateStringArray(Integer n) {
List<String> myArray = new List<String>();
for(Integer i=0;i<n;i++) {
myArray.add('Test '+i);
System.debug(myArray[i]);
}
return myArray;
}
}
2. Second Code I tried
public class StringArrayTest {
public static List<String> generateStringArray(Integer n) {
List<String> List1 = new List<String>();
for(Integer i =0; i < n; ++i)
List1.add('Test ' + i);
return List1;
}
}
I am executing this code from DEBUG > Open Execute Anonymous Window and writing below code to call method.
StringArrayTest.generateStringArray(5);
Please suggest, How can I fix this
Thanks
Pradeep
i am getting error while solving trailhead challange. please find below error.
"Method does not exist or incorrect signature: void generateStringArray(Integer) from the type StringArrayTest"
I tried some code given as best answers.
1. First Code I tried
public class StringArrayTest
{
public static List<String> generateStringArray(Integer n) {
List<String> myArray = new List<String>();
for(Integer i=0;i<n;i++) {
myArray.add('Test '+i);
System.debug(myArray[i]);
}
return myArray;
}
}
2. Second Code I tried
public class StringArrayTest {
public static List<String> generateStringArray(Integer n) {
List<String> List1 = new List<String>();
for(Integer i =0; i < n; ++i)
List1.add('Test ' + i);
return List1;
}
}
I am executing this code from DEBUG > Open Execute Anonymous Window and writing below code to call method.
StringArrayTest.generateStringArray(5);
Please suggest, How can I fix this
Thanks
Pradeep
Greetings to you!
- I read your problem and implemented in my Org. Please use the below Execute Anonymous and class [ Solved]: -
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha.
All Answers
Greetings to you!
- I read your problem and implemented in my Org. Please use the below Execute Anonymous and class [ Solved]: -
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha.
I have impelemented your code but giving same error.
Please find below screen shot.
I have also changed my trailhead playground but the same error is coming. please advise.
Thanks
Pradeep
Greetings to you!
- Your class is not saved after changes. please first save the apex class using 'Ctrl+s'.
- Then use 'Execute Anonymous'.
- Please find below screenshot for correction.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha.
It is working fine now. :)
Thanks & Regards
Pradeep