Katmcfee483 Katmcfee483
  • 14-09-2019
  • Computers and Technology
contestada

Why is String final in Java?

Respuesta :

ExieFansler ExieFansler
  • 17-09-2019

Answer:

string objects are cached in string pool.

Explanation:

Strings in Java are immutable or final because the string objects are cached in String Pool.As we know multiple clients share the string literals so there exists a risk of one client's action affecting all other clients.

For ex:-The value of string is "Roast" and client changed it to "ROAST" so all other clients will see ROAST instead of Roast.

Answer Link

Otras preguntas

In the 1930s, newspaper comics entertained people by making them laugh and offering
Which body of water is located between Southwest Asia and Southeast Asia? (1) Pacific Ocean (3) Indian Ocean (2) Caribbean Sea (4) Black Sea
what is between 4.5 and 5.0
Which body of water is located between Southwest Asia and Southeast Asia? (1) Pacific Ocean (3) Indian Ocean (2) Caribbean Sea (4) Black Sea
Use distributive property to rewrite 9(10+x) A. 19+9x B. 90+9x C. 90+x D. 10+9x
Laws in the South which confirmed the belief that slaves were property and should be protected by the public were called: property laws slave codes civil codes
what is the problem of this solving?!
what is the best medicine for the constriction of the vessels rod from brain?
is " No hay que correr en esa calle" grammatically incorrect?
Wich process producers only identical offspring