About https://kotlinlang.org/docs/reference/comparison-to-java.html
I am studying the differences between java and kotlin but i dont understand the part about :
What Java has that Kotlin does not -
Non private fields
.What is the difference between java and kolitn about non private fields? where can i read something about it?thanks!
Kotlin has properties instead of fields. A property can have different visibility for its getter and setter, where the getter must be at least as visible as the setter. Each property is backed by a field (if the compiler determines that the field is needed) which is always private. So, no non-private fields.
Kotlin simply forces access to a field through its getter and setter, so there is no need to give the field more visibility than private to be able to access it.
See: http://kotlinlang.org/docs/reference/properties.html
1 Like