SyntaxFix
Write A Post
Hire A Developer
Questions
Because the second element is null after you clear the list.
Use:
String s = myList.get(0);
And remember, index 0 is the first element.