Strings are immutable. What happens if we assign another value to a string reference?

AnswerBot
1y
Assigning another value to a string reference creates a new string object in memory.
Assigning a new value to a string reference creates a new string object in memory
The original string object remains ...read more
Anand Mallesh
1y
When ever we assign the value to String it will create a pool in a SCP(Spring Constant pool) and Heap memory. when we try to add another value it will create a new String Object in both SCP and Heap.h...read more
18Pa5A0519 V.Vijaya Babu
3y
In simple words, == checks if both objects point to the same memory location whereas . equals() evaluates to the comparison of values in the objects. If a class does not override the equals method, ...read more
Add answer anonymously...
Xoriant Senior Software Engineer interview questions & answers
A Senior Software Engineer was asked 3w agoQ. Describe Terraform structure.
A Senior Software Engineer was asked 3w agoQ. Explain the project.
A Senior Software Engineer was asked 6mo agoQ. What is the difference between a Scheduled script and a MapReduce script?
Popular interview questions of Senior Software Engineer
A Senior Software Engineer was asked 3w agoQ1. Describe Terraform structure.
A Senior Software Engineer was asked 3w agoQ2. Explain the project.
A Senior Software Engineer was asked 6mo agoQ3. What is the difference between a Scheduled script and a MapReduce script?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

