comparing object | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

comparing object

example when the output is true,because all the time we compare refrence then in any code the output will be false only.

12th Aug 2018, 6:29 AM
jyoti dhakad
jyoti dhakad - avatar
1 Answer
+ 7
objects are given there own unique refrenece although they might look the same they are 2 diffrent objects of the same class, Strings are also objects but comparing these is diffrent as there stored in the string pool if you have 2 strings with the same value they are both the same object unless you create a new string.
12th Aug 2018, 7:40 AM
D_Stark
D_Stark - avatar