Why string is immutable with example?



Why string is immutable with example?..

Answer / Dharamveer

Strings in Core Java are immutable because once created, they cannot be modified. For example, when you assign a new value to a String using the += operator, it actually creates a new String object and discards the old one.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

How is tree Mirroring implemented?

1 Answers   Fidelity,


Is &&= a valid Java operator?

2 Answers  


What is public static?

1 Answers  


What restrictions are placed on method overriding in java programming?

1 Answers  


What is a reflection package?

2 Answers  


How many types of interfaces are there?

1 Answers  


What is a file pointer?

1 Answers  


Is main a function?

1 Answers  


What is the definition of tree ?

1 Answers   Amazon,


What does string [] args mean?

1 Answers  


Which are different kinds of source code?

1 Answers  


What is math exp in java?

1 Answers  


Categories