Code Discussion

Code Discussion

I was attending an android development course, in Member classes the instructor said that to change value of variable in class we should type

"fun main() {

var umar = Person("Umar", "Akram", 16)

umar.hobby = "Playing chess"

umar.getHobby()

}

class Person(firstName:String = "John", secondName:String = "Doe"){

var age : Int? = null

var hobby : String = "Watching Netflix"

var firstName :String? = null ".

Then I was wondering about that we can use (

var hobby = "Anything"

) instead
what do you think?

submitted by /u/umarrakram_
[link] [comments]