Skip to content

PACKAGE_PROTECTED

A package-protected Java declaration is visible in its class, package, and in all subclasses (even outside the package).

Unlike Kotlin, protected visibility in Java allows usages not only from inherited classes, but also from other classes in the same package. Effectively, it is a union of PROTECTED and PACKAGE_PRIVATE.

public class JavaClass { // public
    protected void packageProtectedMember() { // package-protected
    }

    protected static void packageProtectedStaticMember() { // package-protected
    }
}

Properties

name

val name: String

ordinal

val ordinal: Int