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 is a singleton bad?

0 Answers  


Can one thread block the other thread?

0 Answers  


Is a class an object?

0 Answers  


Why call by value prevents parameter value change?

0 Answers  


What are the advantages of the model over the event- inheritance model?

1 Answers  






Explain about main() method in java ?

0 Answers  


How can we achieve IPC in JAVA?

1 Answers   Wipro,


What is a get method?

0 Answers  


How many types of voids are there?

0 Answers  


What are features of java?

0 Answers  


What is not thread safe?

0 Answers  


how can we import the user defined package without classpath?

1 Answers   CSC, Infosys,


Categories