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

Why main function is static?

0 Answers   MCN Solutions,


Why is an interface be able to extend more than one interface but a class can’t extend more than one class?

0 Answers  


What is a byte string?

0 Answers  


what do you understand by the term string with respect to java?

0 Answers  


perpare on factorypattern,linklist wothout using collection, (multitharding ie create producer/customer therad producer create Queue continuesly,consumer consume queue, consumer wait if queue is full,producer wait if queue is empty),diff betn sleep(1000)&wait(1000) these r the main Q ask in huawei(2008)

1 Answers   Huawei,






Why char array is favored over string for the storage of passwords?

0 Answers  


What are the benefits of operations in java?

0 Answers  


Explain jdk, jre and jvm?

0 Answers  


What is meant by final class?

0 Answers  


What is the difference between equals() and == in java?

0 Answers  


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

2 Answers   HP, SparkTG,


Explain implementation and how is it different from conversion?

0 Answers   Aricent,


Categories