Member-only story

🚀Crack the Interview: Interview Questions Series Part 7: 2025

android interview series part 7

1️⃣What is the difference between the publicand openkeywords in Kotlin?
Answer:

In Kotlin, the publickeyword makes a class, function, or property accessible from anywhere. It’s the default visibility modifier if none is specified.
The open keyword allows a class or function to be inherited or overridden. By default, classes and functions in Kotlin are final(cannot be inherited or overridden), and the open modifier is needed to make them extendable or modifiable.

2️⃣Can you explain why abstract methods in Kotlin cannot have a body and how they differ from methods with default implementations?
Answer
: Abstract methods in Kotlin cannot have a body because they are meant to be implemented by subclasses.
The purpose of an abstract method is to define a contract that the subclass must fulfill.
If a body were provided, it would defeat the purpose of requiring the subclass to provide its own implementation.
Methods with default implementations, on the other hand, can have a body and provide a default behavior that subclasses can either use or override.

3️⃣What is the modifier parameter in Jetpack Compose?
Answer:

In Jetpack Compose, the…

--

--

No responses yet