There is an amount parameter in the class Cups, which shows the number of cups. Override toString() so that when you print an object of the Cups class, the number of cups is printed.
Computer scienceProgramming languagesKotlinObject-oriented programmingObject-oriented programming usage
toString()
Number of cups
Report a typo
Write a program in Kotlin
class Cups(val amount: Int) {
override fun toString(): String {
return (...)
}
}
___
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.