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

Article 5 of the Constitution outlines a second method for amending the Constitution in which
How can 225% also be expressed as a fraction or mixed number? Express in simplest form.
Some political theorists might argue that individual rights must, at times, be sacrificed to promote what?
What is the ratio of x to y? 3x = 8y A.1/3 B.1/8 C.8/3 D.3/8
The Cost of 625 bolts is $100.What is the coast of 10 bolts? Please explain it or showed work ,Thank you
What's the answer to -15+n=-9
The phrase "eight more than a number" can be written as which variable expression? A. 8x B. x-8 C. x+8 D. 8x-8
round 5.67 to the nearest tenth
Parker is testing 2 different types of ant killer in his yard. He purchases Brand A and Brand B from the home improvement store. He applies Brand A in the front
An equation is shown below: −2(4x − 1) − 7 = 5 Which statement shows a correct next step in solving the equation? A)The equation can become −2(4x − 1) = −2 by a