August 2018
Beginner
178 pages
4h 56m
English
Kotlin, like most other modern languages (Java included), has immutable strings. The same String class from Java is used in Kotlin, but Kotlin has quite a lot of extension methods in the standard library that add additional functionality to it.
But, there is one big difference from Java: equality comparison. Kotlin overrides the == operator so it can be used to compare Strings based on their value, not their reference (memory address). In Java, if you want to check if Strings are equal based on their value, you have to compare them with an equals method.
String variables are usually declared with String literals, which have to be enclosed in double quotes, as the following command shows:
val s: String = "Kotlin"
Another great thing ...
Read now
Unlock full access