👱 String variables are stored in “constant string pool”. Once the string reference changes the old value that exists in the “constant string pool”, it cannot be erased. Example: String name = “book”; Constant string pool . If the name value has changed from “book” to “pen”. Constant string pool Then the older value retains in the constant string pool. Basically, string is a sequence of characters but it’s not a primitive type. When we create a string in java, it actually creates an object of type String. String is the immutable object which means that it cannot be changed once it is created. String is the only class where operator overloading is supported in Java. We can concat two strings using the + operator. For example "a"+"b"="ab". Java provides two useful classes for String manipulation – StringBuffer and StringBuilder. String Buffer: Here string values are stored in a stack. If the values are changed then the new va...
it's always a good idea to keep track of your learning.