String is immutable but what happens if we assign another value to that 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
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter