You need to sign in to do that
Don't have an account?
Adriana Reyes 7
I'm just playing arround with lists and it seems basic, but I keep getting errors. What am I doing wrong? I literally just copied and pasted, and got the error. I get both errors on the second line:
- Extra ')', at 'a'.
- Invalid constructor name: myList.add
List.add error
List<String> myList = new List<String>(); myList.add('a');
I'm just playing arround with lists and it seems basic, but I keep getting errors. What am I doing wrong? I literally just copied and pasted, and got the error. I get both errors on the second line:
- Extra ')', at 'a'.
- Invalid constructor name: myList.add
OR
YOu might have an apex class with name myList whihc is conflicting
But this code is correct
This is my class. I'm still getting the same errors for the second line. I changed the name. Does it have something to do with the class?
Go to Setup --> apex class --> you can find the class name "List"
I have gone through your code and found that you have not created a constructor or method to add items to your list.
Have a look at the code below and try doing it yourself by initializing your list inside a method or constructor:
Hope this explanation will help you resolve your query.
If you find it helpful mark it as best answer so other get help from this.
Thank you.
Akshay