logo

Crowdly

Browser

Додати до Chrome

On antud 3 klassi: public class Fruit { int price = 10; pub...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

On antud 3 klassi:

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?

0%
0%
0%
0%
0%
Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.taltech.ee?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome