Why doesn’t Java have a primitive type for String when most of the other data types do?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
String is an object, it isn’t a primitive type at all, just an array of chars. The reason why primitive types exist in Java at all is an interesting one, excerpt from a James Gosling interview:
So in short the primitive types exist for efficiency reasons.