Sobes.tech
Junior — Middle

Which access modifier in Java is absent in Kotlin?

sobes.tech AI

Answer from AI

In Java, there is a access modifier "protected" that allows access to class members within the package and in subclasses. In Kotlin, the "protected" modifier is absent in the same sense as in Java. In Kotlin, "protected" restricts access only to subclasses, but not packages, since Kotlin does not have the concept of packages as a scope. Therefore, the "package-private" access modifier (absence of a modifier in Java) is absent in Kotlin.