Why can't I declare an ArrayList of char, I know the String class exist but it still seem weird I can't do the following piece of code
ArrayList<char> foo = new ArrayList<char>();
You cannot use primitive types as a generic type-parameter; you need to use the wrapper class for char, which is Character:
List<Character> characterList = new ArrayList<>(); //Java 7
or
List<Character> characterList = new ArrayList<Character>(); //Java 5,6
This goes for any class that accepts a generic type-parameter. So for example, if you had tried to use int, you would get the same error. Instead, you would have had to use Integer.
its Character not char
List<Character> foo = new ArrayList<Character>();
From starting letter you can easily makeout that char is not class
Character.