val john = "Name"
val rock = "Name"
john == rock // true (structural equality)
john === rock // false (referential equality)
In case of String initialization:
Whenever we initialize a new String object using "", it is automatically placed in the string pool. Such strings will always reference the same object. Where as if we create String with constructor then it will return false.
val john = "Name"
val rock = String(charArrayOf('N','a','m','e'))
val Joe = "Name"
john === rock // false
john === Joe // true