I am trying to coding Java and adding a char to an array. My idea is compare two char, if they are different, I will add them to an array and here is my code.
ArrayList<String> different = new ArrayList<>();
if (character.charAt(i) == (character.charAt(i+1)))
{
}
else
{
different.add(character.charAt(i+1));
}
But when I run my code, they said to me that "no suitable method found for add (char)" at line 6, and I can not run the code. Could you please give me some ideas? Thank you very much for your help.