Computer Science, asked by aynulhoque, 3 months ago

Strings in java are mutable?true or false

Answers

Answered by pdeb
0

false

The Java String is immutable which means it cannot be changed. Whenever we change any string, a new instance is created. For mutable strings, you can use StringBuffer and StringBuilder classes.

Answered by shilpa85475
1

False

  • Java strings are immutable . That is , it cannot be changed . Every time you change a string , a new instance is created .
  • For mutable strings , you can use the String Buffer and String Builder classes .
  • Usually a string is a sequence of characters . However , in Java , a string is an object that represents a sequence of characters .
  • The java Lang String class is used to create string objects .
  • When discussing snapshot graphs in Basic Java , remember that some objects are immutable : once created , they always represent the same value .
  • Other objects are mutable : there are methods that change the value of an object . A string is an example of an immutable type .
  • The Java string pool is a special area of ''memory where the JVM stores strings .
  • Strings of Java are immutable , so the JVM keeps only one copy of each string literal in the pool , optimizing the amount of allocated memory .

#SPJ3

Similar questions