maximum(3, 4); } public int maximum(int first) { return maximum(first, 4); } public int maximumFirstDefault(int second) { return maximum(3, second); } public int maximum(int first, int second) { return first > second ? first : second; }
be null • Accessing that reference at compile is ok • Accessing that reference at runtime: ◦ May be ok ◦ May crash the system Nullability Problem Defined https://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare
.of) ◦ I have to write down Optional?? ◦ I have to ask isPresent() and then get()???? • Kotlin’s solution - Built-in Nullable type Nullability Solution
interpolation is fun override fun fullName(): String = "${sayName()} Dylan" } abstract class Bob(open val firstName: String): Person { abstract fun fullName(): String //can be omitted fun sayName(): String = "My Name Is Bob" }
"Bob", val lastName: String = "Dole"): Bob(firstName) { override fun fullName(): String = "I'm Bob Dole" } abstract class Bob(open val firstName: String): Person { abstract fun fullName(): String //can be omitted fun sayName(): String = "My Name Is Bob" }