Create a string usingh methid new keyword

Dear Sir,
It is said that when using a new keyword to create a string even if string exists in intern pool
a new string of same name but different address is created.
But when i create string using both method the address is coming to be same. Why is this case

Hi Mohit
When we create a String via the new operator, the Java compiler will create a new object and store it in the heap space reserved for the JVM.
Every String created like this will point to a different memory region with its own address.

Hi Mohit,
as you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.