Actually, I am new to kotlin; therefore, this question may be very basic.
According to kotlin documentation, two variables can be compared with ===
and ==
operators.
First one ('==') checks if they have same content or not, and the second one ('+==') checks if they have same reference or not.
However, I cannot find any built-in class whose objects have same content, but with different references.
var str1 : String = "Hello World"
var str2 : String = "Hello World"
if( str1 == str2 ){ // yes
print("Their contents are same\n")
{
if( str1 === str2 ){ // yes
print("Their references are same\n")
}
Instances of all classes I have encountered up to now have same reference if their contents are same. How do we define two objects which have same content, but different references ?