Created
March 11, 2018 14:05
-
-
Save ruwanka/88e8503a92db5b0dadf8b001bfac9640 to your computer and use it in GitHub Desktop.
Kotlin nullable types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Address(var street: String?, var City: String) | |
class User(var name: String, var address: Address?) | |
fun main(args: Array<String>) { | |
var address = Address(null, "Colombo") | |
var user = User("Dharmapala", address) | |
println(user.address?.street?.toUpperCase()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment