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 |
Are true and false keywords?
What are the differences between wait() and sleep()?
Can we serialize singleton class?
What is the file extension for java?
How do you create a reference in java?
What is e in java?
How do you reverse a string in java without using string buffer?
What are different types of Exceptions?.
If A Class Is Declared Without Any Access Modifiers, Where May The Class Be Accessed?
I want my class to be developed in such a way that no other class (even derived class) can create its objects. How can I do so?
Can a constructor be made final?
Compare Mutex and Semaphore in java.