Why are empty Strings valid and empty chars are not ?
I would have thought an empty String is not a string but just a placeholder. The same for a char, but creating an empty char does not even compile.
What im wondering is why the following occurs –
Compiles –
String s = "";
Does not compile –
char c = '';
Because
charrepresents a single character, which''isn’t. A String can contain zero or more characters, but a character cannot be anything other than a single character.