As I've been learning about a few different languages, I've seen that java is the only one with a "char" datatype. For example, charAt() for javascript returns a string whereas in java the method returns a character. Is there a reason for a "character" datatype and why don't other languages use them?
3 Answers
Most of the time, if you are using a single character value, you will use the primitive char type.
For example:
char ch = 'a'; 
Comments
I would like to say and ask myself
for char a='a';  & String a="a";
How much memory does a char variable takes ?
and
How much memory does a string literal or string object takes ?
If you figure this out , Then this answers your question
2 Comments
anshulkatta
 @TheNewIdiot me neither :P
  Adam Hughes
 Char is more memory efficient, but what is a use case where storing characters individually rather than a long string is going to unplug a bottleneck?  EG if I store the genome as a long string, is that saving me overhead over storing three billion characters separately?  I get the idea, but don't see the application
  


charprimitive from C/C++ like languages.chardata type. You should perhaps be asking yourself rather why Javascript doesn't.String.charCodeAt(i)returningNumbertype (which is only other basic type supported by JavaScript), but it is very close to most languages notion ofcharas 8/16bit integer...