note : 1) Bydefault All variable non-null
2) For Accecpting this null value we have to put '?' with string.
3) If variable is null and want to access the properties of variable in that case use 'varible?.'
4) if confirm varible is not null then we can use '!!' but if not sure dont use it trow null pointer exception.
var name:String? = null
val Lname:String = "Nishad"
firstname
println("Hello${name?.length}")
No comments:
Post a Comment