Day 66 | Daily Java interview question | #scjp #ocjp

preview_player
Показать описание
Daily Java interview questions
guess the output
Java programming interview questions
learn Java
Java programming interview questions
play with Java
Java interview questions
core Java interview questions
core Java
Java
#java #javacertification #javaprogramming #javaquestions #javainterviewquestion #learnjava #interview #javatutorial #ocjp #scjp #javacertification #springboot
Рекомендации по теме
Комментарии
Автор

2 objects will be created on string literal process, based on string constant poll process s1, s2 will be hold same addressed
S3 will be creating one more object in heap area of jvm based on new operator, but in this process s3 will hold the address of s2

ymczpfi
Автор

2 object will be created... for the first time string literal store value and create object in scp then second time again they check value is exist or not then they refer/refer same object and with new keyword heap memory and try to create object in scp but there is already created same value object then it is refer/point scp object.. so 2 object will created

vishaldeshmukh
Автор

String is literal so 2 objects will be created how 1.in s1 hello value when s2 hello object created another one is object creation so finally 2 objects created in this code

gandiganumalagandiganumala
Автор

2 will be create, because in SCP we can not store duplicate value then both object have same value then both variable are pointing same value..

_Samar-Coding
Автор

2 one is in heap and another is in scp

Jyotiranjansahoovlogs
Автор

2
String(both values are the same) + new string

arekuti
Автор

Only 2 one is main method and other one using new keyword!

vamsi