Implement the Banana, Orange, Apple objects that inherit from the Fruit class.
Objects and package objects
An object instead of a class
Report a typo
Sample Input 1:
Sample Output 1:
apple
orange
bananaWrite a program in Scala 3
class Fruit(val name: String, val color: String)
class Apple() extends Fruit("apple", "greed")
class Orange() extends Fruit("orange", "orange")
class Banana() extends Fruit("banana", "yellow")
___
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.