You need to sign in to do that
Don't have an account?
tanushree roy 6
Create an Apex class that returns an array (or list) of strings. for Trailhead
tanushree...
I used this code but still m getting error...
where is my mistake can any one plz...
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;
}
}
Thanks
Tanushree
I used this code but still m getting error...
where is my mistake can any one plz...
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;
}
}
Thanks
Tanushree
I tested the this code in my org and invoked it in using execute anonymous.
There is no problem at all.Its working as expected.
Make sure you saved the class before checking challenge or excuting using execute anonymous.
Plase execute StringArray class un=sing below line in execute anonymous and see the debug log.
Please let me know if it helps.
Thanks.
All Answers
plase try below code Thanks.
Thanks for the rply
but still m getting error.
what to do?
What to do next. I couldnt find any mistake.. any one plz ...
I tested the this code in my org and invoked it in using execute anonymous.
There is no problem at all.Its working as expected.
Make sure you saved the class before checking challenge or excuting using execute anonymous.
Plase execute StringArray class un=sing below line in execute anonymous and see the debug log.
Please let me know if it helps.
Thanks.
Thanks for the rply..
Its working fine. But i have doubt that why u r using index instead of integer?
Can u explain this to me...
Thanks and regards
Tanushree Roy