Kotlin provides a new type of class that is not present in the Java language. It is known as sealed classes.
In Android Development with Kotlin, a selected class is defined as a set of subclasses. it is known in advance that a type will conform to subclass types.
Let’s discuss an example of a sealed class.
Syntex: Sealed class of kotlin
Sealed class DemoText
A class can be sealed by using the sealed keyword.
Example: sealed class
Output
Example: sealed class another example
Output
Happy coding!