Why it error when i make userName is public:
Error:(2, 5) Kotlin: Platform declaration clash: The following declarations have the same JVM signature (getUserName()Ljava/lang/String;): fun (): String defined in User fun getUserName(): String defined in User
Error:(4, 5) Kotlin: Platform declaration clash: The following declarations have the same JVM signature (getUserName()Ljava/lang/String;): fun (): String defined in User fun getUserName(): String defined in User
But i make userName is private is working fine
class User{
/*private*/ var userName: String = "Emily"
fun getUserName(): String{
return userName
}
}
fun main(args: Array<String>){
val User = User()
print(User.getUserName())
}