How do you convert an Int variable to Long?Call toLong(): val total = count.toLong(). Int is not a subtype of Long. An untyped integer literal may instead receive Long as its expected type. Conversions.
Why is reference identity a poor choice for comparing boxed numbers?Identity checks object references, and boxing can reuse cached objects. Integer.valueOf guarantees −128..127 and may cache more values. Compare numeric values with ==, without relying on a particular cache boundary. Integer.valueOf.
Why can an Elvis expression end with throw?Throw has type Nothing and does not complete normally. With a nullable String on the left, the successful Elvis branch supplies a non-null String. Null safety, Nothing.
What is the difference between == and ===?== performs null-safe structural equality through equals; === checks reference identity where applicable. Array contents require contentEquals because ordinary array equality does not compare elements. Equality.