Cheat Sheet for Kotlin
I had prepared a list of most common questions asked during Kotlin Android Interviews for Android developer profile. Therefore, if you are preparing for Android Interviews, then this article is a must for you. Question: What are the visibility modifiers in Kotlin? A visibility modifier or access specifier also called as access modifier is a concept that is used to define the scope of something in a programming language. In Kotlin, we have four visibility modifiers: private : visible inside that particular class or file containing the declaration. protected : visible inside that particular class or file and also in the subclass of that particular class where it is declared. internal : visible everywhere in that particular module. public : visible to everyone. Note: By default, the visibility modifier in Kotlin is public . Question: What are the types of constructors in Kotlin? Constructors in Kotlin are of two types: Primary — These are defined in the class headers. They cannot hold