Java, Spring, Microservices, Interview, Coding.
improves performance. String a2 = new String("Ajay"): This creates a new String object using the new keyword and the String constructor. A new object is allocated in the heap memory, containing the characters "Ajay". This creates a separate copy of the string even if it has the same characters as a