What are the modifiers that are available in Kotlin?

devquora
devquora

Posted On: Jun 24, 2024

 

Access modifier in Kotlin provides the developer to customize the declarations as per the requirements. Kotlin provides four modifiers. They are:
Private: This makes the declaration visible only inside the file containing a declaration.

Public: It is by default, which means that the declarations will be visible everywhere.

Internal: This makes the declaration visible everywhere in the same modules.

Protected: This keeps the declaration protected and is not available for top-level declarations.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Kotlin Interview Questions

    What is Kotlin?

    Kotlin is an open-source language combining object-oriented programming features. Notable features include range expressions, extension functions, companion objects, smart casts, and data classes, off..

    Kotlin Interview Questions

    Which type of Programming does Kotlin support?

    Kotlin supports OOP with classes and objects, FP with higher-order functions and immutability, and procedural programming for sequential execution, catering to diverse software development approaches...