Define a sealed class called Color. Inside it, put three colors (namely Red, Blue, and Green) as objects. And finally, add a class called CustomColor, which has hex as a variable of String type, in the primary constructor.
Computer scienceProgramming languagesKotlinObject-oriented programmingObject-oriented programming usage
Sealed class and interface
Container of colors
Report a typo
Write a program in Kotlin
// write code here
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.