Interview Question: How many String Objects will be created? - String Objects & String Constant Pool

preview_player
Показать описание
~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:

Follow me on my Facebook Page:

Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:

Naveen AutomationLabs Paid Courses:
Java & Selenium:

Java & API +POSTMAN + RestAssured + HttpClient:
Рекомендации по теме
Комментарии
Автор

How can someone explain with this level of clarity. I am amazed by your explanation skills, you are just the best👏

sanghamitrabhowmicklive
Автор

With 10 mins a very important question got covered and for the same people will take sometimes ½ hour session, Thanks Naveen for the video 👍😊

SarangHoley
Автор

Hello naveen... Thanku very much... I have worked as a manual tester... But only becoz of u i got a job in mnc as a automation

barkhachetwani
Автор

By far the best explanation of String objects!

rukhma
Автор

These interview questions series is really very helpful. Thanks a lot sir.

spaininsights
Автор

Thanks People with zero knowledge on Java can understand your explanation from basix.. You are different

sivaswamy
Автор

Able to understand very clear. Really appreciating for your efforts. Thank you sir

pachimalaanu
Автор

New series is started. Thanks Naveen. Please upload more videos.

kavishautomationfactory
Автор

Very best explanation very nice concept I got concept from this video thanks..

deepchand
Автор

Thanks a Lot for taking up this topic. Concept is clear now

jayantamandal
Автор

Naveen Ji, Thank you for sharing this information...👍👍🙏🙂

MadirajuKChaitanya
Автор

Amazing explanation, Naveen 😊 really hats off to you

artimandale
Автор

Wow ! that was an amazing explanation. Nobody does it better ;)

atulchavan
Автор

it will create 2 objects
one in heap area and
another one is string constant pool area i.e SCP area(if the object is not there with the same content if object is already with same content i won't create new object) and string ref n1 is pointing to heap area object

shankarcheerala
Автор

Such a beautiful explanation...sir, please can you explain how many objects will be created if we concat 2 strings

namitharose
Автор

Great series again Naveen!! Very helpful!! Thanks a lot!!

RajeshChilkamari
Автор

Incredible job naveen, thank you very much 🙏

snehaparekh
Автор

String str1 = new String("Hello World");
String str2 = "Hello World";
if(str1 == str2)
str1 and str2 are equal");
else
str1 and str2 are not equals");
//output : Strings str1 and str2 are not equals

/* If the new String causes the string to be added to the string pool (as you claim) then the next if statement
* should return true...which it does not ...
* When you create a string using new ...yes its created in the heap but it does not get
* added to the string intern pool unless actually added
*
* Look at the next e.g. and checkout the difference for yourself
*/

String str3 = new String("Blue Sky").intern();
String str4 = "Blue Sky";
if(str3 == str4)
str3 and str4 are equal");
else
str3 and str4 are not equals");
//output : Strings str3 and str4 are equal
/* In order to add a string created using new to the string intern pool is to specifically add it...as in case of str3
* str4 is a string literal and has the reference of str3 - since str3 was in the string intern pool
*
*/

metronadsouza
Автор

Thank u Naveen Sir. Its's really cleared and helpful. :)

bhavikapatel
Автор

Naveen 4:47 you said 4 objects created ...the same but here 8:49 you telling 3 objects. It quite confuse. Please clarify. Your videos are awesome thanks for your effort....

dowlathbashag