✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
public class Fruit { int price = 10; public int getPrice() { return price; }}
public class Apple extends Fruit { @Override public int getPrice() { return super.getPrice() * 3 + super.getPrice(); }}
public class Main { public static void main(String[] args) { Fruit fruit = new Fruit(); Apple firstApple = new Apple(); Apple secondApple = new Apple(); System.out.println(fruit.getPrice() + firstApple.getPrice() + secondApple.getPrice()); }}
Mis on programmi väljund?