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



why string is not taking as primitive datatypes but we r taking it as a class? why explain it?..

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

why string is not taking as primitive datatypes but we r taking it as a class? why explain it?..

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

Post New Answer

More Core Java Interview Questions

How can we make copy of a java object?

0 Answers  


Do you know how to reverse string in java?

0 Answers  


Does constructor creates the object ?

0 Answers  


How are this() and super() used with constructors in java programming?

0 Answers  


How many threads can java run?

0 Answers  


What is the Dictionary class?

1 Answers  


Explain the features of interfaces in java?

0 Answers  


What is the immediate parent class of the Applet class?

1 Answers  


string is immutable? right every one knows that, my question is it advantage or disadvantage making string immutable?

5 Answers   HCL,


What does exclamation mean in java?

0 Answers  


How to declare objects of a class ?

0 Answers   Akamai Technologies,


How do you sing an Applet ?

0 Answers  


Categories