why string is not taking as primitive datatypes but we r
taking it as a class? why explain it?
Answers were Sorted based on User's Feedback
Answer / ankit
All primitive types have fixed memory size. Now in case of
the String, its length is not fixed and so is its size.
That's why it cannot be a primitive data type.
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / payel
String should be class so that it can be immutable and
making String immutable, makes it thread safe and
thus imporves performance.
| Is This Answer Correct ? | 2 Yes | 2 No |
how to call a method in different package?
What does int [] mean in java?
What is the difference between a field variable and a local variable?
What is a arraylist in java?
Why is stringbuffer not immutable?
What is scope of a variable?
How to perform selection sort in java?
What will happen if we cannot mention "finally" in Java Program ???
What language is pass by reference?
Why char array is preferred over string for storing password?
Is there a sort function in java?
What is the use of static class?